0

I am writing a phantomjs script that clicks through a webpage. This page is a single page application an the url doesn't change when a button or link is clicked.

My problems:

  1. I can not be sure if an element is rendered. I can check if the element exists with $('#id').length > 0, but I don't know what to do next. One way would be to set a timeout and call the funktion again to check again if the element exists, but I think this is a very bad solution for the problem.

  2. How can I call a function after all the inputs are filled and the button was clicked?

Example:
Step one:
Fill userName & password
click login button

Step two: check if redbutton is rendered
click the button

Artjom B.
  • 61,146
  • 24
  • 125
  • 222
Frank
  • 161
  • 1
  • 1
  • 7
  • *I think this is a very bad solution for the problem.* It's the only sensible solution since there are no DOM events outside of the page context. – Artjom B. Oct 31 '14 at 10:18
  • That might help. Thank you. For my second problem, to do one step after the other, i can maybe use casperjs – Frank Oct 31 '14 at 14:35
  • That depends on what happens on the page after a button was clicked. Does it load another page or does it just change the DOM? You could do this with PhantomJS, but with CasperJS it is probably easier if you navigate a lot. – Artjom B. Oct 31 '14 at 14:43

0 Answers0