element = driver.find_element :name => "username"
element.send_keys "*****"
element = driver.find_element :name => "password"
element.send_keys "*****"
element.submit
Now point is when the "driver" opened the URL on the browser, Some times
the next page to which username and password has to be put by the
script, not coming- which causes the script to failed. Some intermediate
page is coming asking us to click on 'retry button' or 'refresh the
page'. Thus the script whenever such case occurred stopped execution, as
not getting the mentioned element.
So is there any way to refresh that intermediate page with "sleep"
before going to the "Log-in" page, so that script can run in one go?
driver.url is the current url, so it effectively refreshes the page.
You can obviously customise my example to loop as many times as you
like, but I'd recommend avoiding infinite loops.
The "refresh" should not be necessary because the first line executed on
a retry is
driver.get "https://example.com/"
thus negating the need to refresh the page.