Resolve domain certificate error in Selenium

Selenium webdriver loads the webpages and navigate automatically as scripted. Some of the popular web-drivers are of ChromeDriver, FirefoxDriver, IWebDriver and PythonJS. Though PythonJS is becoming out-dated it is still considered one of the fastest web-driver to run in the background.

Domain certificates are often not taken seriously for Test environments and the development continues even if this certificate is expired. Though the website will work correctly, the certificate icon in the browser will highlight this issue.

If your website is hosted in a Test environment where the domain SSL certificate is expired then automation scripts fail due to an invalid certificate error. This issue doesn't resolve by changing the web-driver but can only be fixed by adding driver options into your web-driver to bypass such certificate errors. Below piece of code shows the use of ChromeDriver to ignore certificate errors:

ChromeOptions = new ChromeOptions();
option.AddAgrument("headless");
option.AddAgrument("disable-gpu");
option.AcceptInsecureCertificates = true;
option.AddAgrument("ignore-certificate-errors");
option.AddAgrument("windows-size=1280,1024");
option.AddAgrument("no-sandbox");

ChromeDriver driver = new ChromeDriver();
driver = new ChromeDriver(option);
driver.Navigate().GoToUrl("<<websiteUrl>>");

Windows authentication popup issue can be resolved by implementing Impersonation in web-driver.

No comments:

Post a Comment