I need to run a javascript function from a phpunit test with selenium and check the javascript returns true. I've looked into using runScript but it never seems to run (I've tested this by adding an alert to the code, but it never shows..).
My javascript needs to check the opacity of an element is 1, if not use setTimeout to run the function again. - What this code is basically trying to do is ensure an ajax call has been called (the element to be replaced goes to half opacity when being updated and back to full when updated)
Is runScript the correct function, or is there a better way to check the ajax has run? Here's the JS:
function seleniumCheckOpacity(elementId, counter) {
if(counter >= 5) return false;
else if($(elementId).opacity == 1) return true;
else {
counter++
return setTimeout('seleniumCheckOpacity('+elemelementId+', '+counter+')', 500);
}
}