[英]How to perform a click on a href with javascript function with nightmare
I wanted to know how can i click a button with nightmare with this attributes .我想知道如何单击带有此属性的噩梦按钮。
<a class="auth_button leftbtn" href="javascript:SubmitAuthCode( 'enter a friendly name here' );">
<h3>Submit</h3>
<h5>my special access code</h5>
</a>
I tried to use the click() method like this :我尝试像这样使用 click() 方法:
.click('.auth_button leftbtn');
But it just doesn't click it( Probably because its not a "real" button - might be wrong)但它只是没有点击它(可能是因为它不是“真正的”按钮 - 可能是错误的)
Any ideas why?Or how should i do it instead任何想法为什么? 或者我应该怎么做
I may found out why the .click() doesn't work:我可能会发现为什么 .click() 不起作用:
<div class="modal_buttons" id="auth_buttonsets">
<div class="auth_buttonset" id="auth_buttonset_entercode" style="display: none;">
<a class="auth_button leftbtn" href="javascript:SubmitAuthCode( 'enter a friendly name here' );">
<h3>Submit</h3>
<h5>my special access code</h5>
</a>
<a class="auth_button" href="javascript:SetEmailAuthModalState( 'checkspam' );">
<h3>What message?</h3>
<h5>I don't have any message from Steam Support...</h5>
</a>
<div style="clear: left;"></div>
</div>
<div class="auth_buttonset" id="auth_buttonset_checkspam" style="display: none;">
<a class="auth_button leftbtn" href="javascript:SubmitAuthCode( 'enter a friendly name here' );">
<h3>Found it!</h3>
<h5>and I've entered my special access code above</h5>
</a>
<a class="auth_button" href="javascript:SetEmailAuthModalState( 'help' );">
<h3>No luck still...</h3>
<h5>I don't have any message from Steam Support...</h5>
</a>
<div style="clear: left;"></div>
</div>
</div>
The button i'm aiming at is in the the div id=auth_buttonset_entercode
because there are multiple buttons with the same id , but not in the same div .我瞄准的按钮在 div
id=auth_buttonset_entercode
因为有多个按钮具有相同的 id ,但不在同一个 div 中。 Now i dont know how to select the div and then the class at the same selector.现在我不知道如何在同一个选择器中选择 div 和类。
Change it to将其更改为
.click('#auth_buttonset_entercode .auth_button.leftbtn');
So it will select the element with both classes .因此它将选择具有两个 classes的元素。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.