i'd like to know if anyone faced the following problem with Selenium tests run: when scripts are running locally all tests pass, but when they are ran on server for the same site some of tests fail (different tests every day without script changes). The most interesting thing is that if i watch the process on server all tests pass.

Does anyone know what can be the reason and how to fix it? Or at least how to investigate it?

Scripts are running for Firefox browser.


  • Are there any patterns to the failures? Are they failing with the same or similar exceptions? Can you provide us with a sample of the failures? Commented Nov 29, 2011 at 17:20
  • yes, in most cases it cannot find element though i have a custom method which waits for element appearance. tests create some new page elements (links, for example) and then try to interact with them. i'm quite sure these elements appear on page but for some reason Selenium doesn't want to see them when scripts are ran on server. locally there are no such problems
    – Melena
    Commented Nov 29, 2011 at 17:26
  • Can you take screenshots on failure? Being able to see what the screen looked like at the time might give you a hint. Commented Nov 29, 2011 at 17:36
  • i'll try, thank you. However i doubt this would help much because the same script is running on both machines and there is no way to guess which test would fail today :)
    – Melena
    Commented Nov 29, 2011 at 17:54
  • that's exactly what makes me think a screenshot might help. If something external to your tests is interfering, it's likely to leave a visual clue. I'm thinking there might be something else happening on that server that is obscuring Selenium's ability to interact w/ the browser. Commented Nov 29, 2011 at 18:33

1 Answer 1


Here's a problem I've faced before. Some buttons are dependent on JavaScript binds. If you click the button before the JavaScript loads, the button will not have the bound event. Therefore, Selenium will successfully click on the button (since the DOM is loaded properly) but the JavaScript hasn't bound to that particular button yet. Solutions you can try include waiting for the JavaScript bind on the element or continuously clicking on the element until the correct action is performed.

You can adapt this code as needed:

'selenium.browserbot.getCurrentWindow().$("#id").data("events").click' != 'null'


Your Answer

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

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