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 2


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.
    – nobody
    Nov 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.