I\'ve got a suite of Selenium tests that work perfectly in my local environment and using Browserstack Automate, but fail on Azure DevOps.
There are no configurati
Here are some steps I would do :
What helped us in a similar case is to temporarily add a video recorder to tests then watch the test execution process on a VM from start to fail. There could be some clues on a video that help to see what is actually going wrong I was able to find this link for a C# example
Also, I would double check to make sure browser versions on Azure are exactly the same as in the run where it all works well. Making them the same is crucial to make sure there is no 'magic'. Same for the default browser window size.
I would do more detailed analysis of places where different tests fail.
If you use Date/time APIs in your code, make sure the System time/locale/timezone settings are exactly the same. Or that the days do not change during the test runs. All in all - investigate around dates.
I know that the above is more like a general advice, but from my experience such "random failures" could be caused by literally anything that seems "not worth attention".
A few lines from your code block would have helped to analyze your issue in a better way.
However, as your tests always fail because of timeouts it is worth to mention that, in general TimeoutException is the outcome of failed ExpectedConditions. However there can be other issues as well.
Some of the approaches to avoid these issues are as follows:
WARNING: Do not mix implicit and explicit waits. Doing so can cause unpredictable wait times.
You can find a detailed discussion in How can I make sure if some HTML elements are loaded for Selenium
If you are using ChromeDriver and Chrome Browser you must ensure that the binaries are compatible as per the entries below:
Keeping the above mentioned factors in consideration you need to implement the Locator Strategy wisely along with the other approaches discussed above which will help you to get rid of the timeouts.