Selenium: intermittent "element not found" issues -


every , selenium tests randomly fail "element x not found" error message. simple select id, eg.

click('sidebar_querybutton') 

when use dom inspector, element there, wonder why selenium doesn't find sometimes. when run same test again, works or breaks again, there seems no reliable way of reproducing it. tests there ages seem randomly break , magically work again. inserting few sleep statements helps not reliably. wonder if i'm using incorrectly. has else had these problems selenium , if so, how did fix them?

edit: found more reliable put test markers in pages , wait them appear. if use asynchronous operations might create race conditions in tests, inserting test marker html after finish operation worked pretty me. e.g.

$('<div>').addclass("testmarker").append("opxyzfinished").appendto($('#content')); 

that way, can simple "waitfortextpresent" see if things worked out , more reliable guessing browser's loading state. testmarker class needs formatted in way not visible user (e.g. font color == background color).

thanks comments. after deeper digging on net , in our tests found combining these statements instead of simple waitforpagetoload cure our issues:

waitforpagetoload('') // wait until ajax activity has ceased. check's jquery's 

$.active waitforcondition('selenium.browserbot.getuserwindow().$.active == 0', 5000) // wait second js initialize pause(1000)

there still pause in there ugly, trick.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -