Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

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.

Thanks

share|improve this question
    
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? –  Ethel Evans Nov 29 '11 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 Nov 29 '11 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. –  Ethel Evans Nov 29 '11 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 Nov 29 '11 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. –  Ethel Evans Nov 29 '11 at 18:33
show 4 more comments

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'

share|improve this answer
    
i definitely will try. thank you –  Melena Nov 30 '11 at 20:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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