简体   繁体   English

如何获取没有ID的元素,而这与Node.js噩梦有关

[英]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: 我最近开始使用噩梦,但是在获取没有ID或其他信息的信息时遇到了问题,例如,我有以下HTML代码:

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

This is a button, how can I .click() on it through nightmare? 这是一个按钮,我如何才能在噩梦中对其单击.click()

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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