简体   繁体   中英

How to get an element that has no ID with node.js nightmare

I recently started using nightmare, and I am having issues getting information that doesn't have an ID or something For example, I have the following HTML code:

<input type="submit" value="Login" name="reg">

This is a button, how can I .click() on it through nightmare?

使用CSS属性选择器( https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors ):

document.querySelector('input[name=reg]');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM