I dont know why 80% of the time the test works good and sometimes I get an error that element is not visible although im using wait.until....
Its very weird, does anyone get this too?
I dont know why 80% of the time the test works good and sometimes I get an error that element is not visible although im using wait.until....
Its very weird, does anyone get this too?
This is the nightmare of any ui automation engineer..
The trick is how you use your wait efficiently..
Try to use explicit wait and use wait for element to visible option in it..
Also try to use JAVASCRIPT/jQuery click..this'll work even if your element is not visible..But the element should be present..
That variability is precisely what you want to avoid in your tests for them to have credibility.
It's not at all weird, just a classic example of a race condition between the test website's server and the client browser on the one hand, and a very fast automated testing program on the other, that has expectations but works far faster than a human being could. Everyone has seen it at some point.
Here's a good set of examples to help you introduce waits into your Selenium code without needless delays that can massively slow down your tests.
Just to give an idea: sometimes it helps to use different approaches that means the test acts not 100% the way the user would do.
Just refreshing (even a second time) the page and wait that all required elements have been loaded helped me sometimes.
If software has been just deployed webservers need to re-organize and take longer to respond therefore you might increase the timeouts for Selenium.
Another problem e.g. navigation when using floating menus can be solved by direct navigation to the URL, not common but any user might do so.
Bringing back the focus on the current window helped me sometims:
Browser.WebDriver.SwitchTo().Window(Browser.WebDriver.CurrentWindowHandle);