When I am trying to run the automation script without connecting to the internet, the below exception will be returned:
System.Net.WebException: 'The remote name could not be resolved: 'chromedriver.storage.googleapis.com''
Is there any way to execute the script without connecting to the internet (Offline), by using specific chrome version or the version cashed in the WebDriverManager?
Download the chromedriver from: https://sites.google.com/chromium.org/driver/
Once you've downloaded the required files extract the zips to a local drive on your computer.
Make sure to add the path to where you extracting the chromedriver.exe
IWebDriver chromeDriver = new ChromeDriver(@ "D:\Download\chromedriver"); //<-Add your path
driver.NetworkConditions = new ChromeNetworkConditions() {
IsOffline = true, DownloadThroughput = 5000, UploadThroughput = 5000, Latency = TimeSpan.FromMilliseconds(5)
};
driver.Navigate().GoToUrl("https://chris.bolin.co/offline/");
Note: You could also create an environment variable named webdriver.chrome.driver on your machine that's value is the path to where the local chromedriver.exe is located. If you set up a webdriver.chrome.driver variable you would not have to pass the chrome driver argument when you create a ChromeDriver instance