I use HTML driver and when I run the tests and want to click on an element or read text, the elements can not be found. Every time a Exception is thrown I have to save the code of the Page.When I check the Code, the element is there and when I re run the test everything works fine. My guess is that the page was not completely loaded when I try to access the element. So I wait until Selenium has finished loading the page before I try to access elements.
I found two ways to achieve it:
-
Execute Javascript (e.g. window.initComplete) and wait for the result to be true.
-
Wait for the last element on the page to load
Any suggestions ?