After updating to the Firefox to version 52, i had to update gecko driver to v17. But all my previous scripts fail in Firefox, becase it is too fast and not wating for element on the page to load.
I am now forced to add Thread.sleep wait for each click. Is there any solution you guys can help me with?
Works in Chrome better, but need both to be working the same.
I run testNg and the exception i get is: Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
I fixed it by insterting Thread.sleep which is not recommended but this is the only thing that works. Fluent wait didnot work or me
1505314327534 geckodriver INFO Listening on 127.0.0.1:42753 1505314328131 mozprofile::profile INFO Using profile path C:\User\AppData\Local\Temp\rust_mozprofile.NX5A3KOOQr 1505314328136 geckodriver::marionette INFO Starting browser C:/Program Files/Mozilla Firefox/firefox.exe with args [] 1505314328150 geckodriver::marionette INFO Connecting to Marionette on localhost:65331 1505314331570 Marionette INFO Listening on port 65331
One of the objective of Test Automation is to reduce the
Test Execution
time. So it should make us glad if the driver of Firefox i.e.geckodriver
which usesMarionette
acts faster. Now your question must be how to synchronize thegeckodriver
with the real-timeMozilla Firefox Browser
.Thread.sleep(n)
. Slowing down inducingThread.sleep(n)
is not a part of Best Programming practices. It degrades the performance. So lets look at the other available options.Next you mentioned about
not waiting for element on the page to load
. This is a common issue faced while we useWebDriver
. The simplest way to address this is to induceImplicitWait
. In short, by introducingImplicitWait
the driver will poll theHTML DOM
for the configured amount of time looking out for the element or elements. By that time the element or elements for which you had been looking for may be available in theHTML DOM
. An example ofImplicitWait
is as follows:Python:
Java:
You can find the official documentation here and also find a detailed
stackoverflow discussion
here.ImplicitWait
can slow down your Test Execution quite drastically. So in that caseExplicitWait
comes to our rescue. In short,ExplicitWait
is a code block you define, configure and implement for the WebDriver instance to wait for a certain condition to be met before proceeding for the next line of code. An example ofExplicitWait
is as follows:Python:
Java:
You can find the official documentation here and also find a detailed
stackoverflow discussion
here.