0

I am trying to run the on click function SelectPlaystation4 (8th from the bottom). Is PhantomJS able to do this? How can I do this in phantomjs? I have been trying to use evaluate from the docs... with out any luck

<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">
Artjom B.
  • 61,146
  • 24
  • 125
  • 222
Drwooi Poipoi
  • 181
  • 1
  • 2
  • 13

1 Answers1

1

The onclick function doesn't create a click it is just a click handler causing something else to happen when a click is made.

For what you are trying to achieve you need to look into the Phantomjs sendEvent. You can find those docs here.

From the docs:

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).

CryptoPiggy
  • 700
  • 2
  • 8
  • 21
  • page.sendEvent('click', ['200px', '540px', button='left']); Still not working... can't seem to get this to work (also tried with numbers, instead of strings) – Drwooi Poipoi Jul 28 '16 at 05:44