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