I
I
itcry2019-04-20 21:05:58
Google Chrome
itcry, 2019-04-20 21:05:58

How to force Selenium + ChromeDriver to refresh a page if it hasn't loaded in a certain time?

Hello. There is a standard code for opening a browser and loading a specific web page in it:

static IWebDriver Browser;
Browser = new OpenQA.Selenium.Chrome.ChromeDriver();
Browser.Navigate().GoToUrl("https://site.ru");

I know that GoToUrl is implemented to wait for the page to finish loading before the next code starts executing.
But what if the site lags at this moment? There is a certain site that can freeze and never load, but if you press F5, the page will refresh and everything will work.
How to make selenium wait for loading, for example, 30 seconds, and if the site has not loaded, then send a command to refresh the page?
So far I've only found solutions to skip loading

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2019-04-20
@itcry

https://stackoverflow.com/questions/9731291/how-do...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question