我正在尝试运行单击功能SelectPlaystation4(从底部数第8个)。 PhantomJS 能做到这一点吗?我怎样才能在 phantomjs 中做到这一点?我一直在尝试使用文档中的评估...但没有任何运气
<div id="content" class="clearfix">
<section class="content" style="margin-bottom: 35px;">
<div id="col-main" class="clearfix">
<div class="col-md-12 console-ps">
<div class="collection-details text-center">
<h3>
Playstation
</h3>
<div class="line"></div>
<!--<a href="#" class="col-btn btn">PS3</a>-->
<input type="button" class="col-btn btn" onclick="SelectPlaystation4()" value="Playstation 4">
<input type="button" class="col-btn btn" onclick="SelectPlaystation3()" value="Playstation 3">
</div>
</div>
<div class="col-md-12 console-xb">
<div class="collection-details text-center">
最佳答案
onclick
函数不会创建点击,它只是一个点击处理程序
,导致点击时发生其他事情。
对于您想要实现的目标,您需要查看 Phantomjs sendEvent
。你可以找到那些docs here .
来自文档:
Mouse events
sendEvent(mouseEventType[, mouseX, mouseY, button='left'])
The first argument is the event type. Supported types are
'mouseup'
,'mousedown'
,'mousemove'
,'doubleclick'
and'click'
. The next two arguments are optional but represent the mouse position for the event.The button parameter (defaults to
left
) specifies the button to push.For
'mousemove'
, however, there is no button pressed (i.e. it is not dragging).
关于javascript - PhantomJS 我的代码甚至不会点击或运行点击,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38627169/