I have a flaky selenium spec because a notice disappears after page load because of a separate event that happens from polling the client or some other change. One solution would be immediately on page load to just 'freeze' the state of the page and totally disallow any changes to it via js or otherwise just so I can check that expectation. Is there a way to accomplish this with selenium? Selenium webdriver in Ruby to be specific.
2 Answers
yeah, if my understanding is right, you can check for an element's presence with selenium, @driver.find_element
throws an exception called NoSuchElementException
, you can use it to track this notice.
And a notice will usually be inside of an iframe, you may need to locate this iframe first as well.
-
Sorry, I may have been unclear. I have a page that has loaded but the animation on the page disappears too quickly. As such, I want to stop the page from having any other animations or javascript after an initial load since something on the front end breaks my stuff and I want to make sure nothing else occurs.– nobodyNov 20, 2016 at 5:40
Selenium CANNOT stop javascript animations or any other actions going on in the page. Exactly like user cannot do any of those things. Why you expected it?
Solution is to change the javascript.