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.

Handle authentication popup in Selenium on build server

Selenium scripts are widely used for automation testing of ASP.Net web applications hosted on VSTS or TFS. These automation scripts are configured to trigger automatically on build server while Continuous Integration.

Selenium webdriver loads the webpages and navigate automatically as scripted. Some of the popular webdrivers are ChromeDriver, FirefoxDriver, IWebDriver and PythonJS.

Webdriver in automation scripts often work flawlessly in development environment by auto-login using the testing user's credentials saved in Windows Credential store. When the same scripts are ran in VSTS or TFS during Continuous Integration then the Windows auto-login fail because the VSTS servers don't have these Windows credentials to auto-populate in webdriver.

The other difference of running webdriver in development environment is that it load webpages in browser and visible to the user, but webdriver runs in background on VSTS servers.

This authentication issue can be resolved by implementing Impersonation while loading webdriver to bypass Windows authentication. Below piece of code can be used to achieve this:

using (new Impersonator("<<loginId>>", "<<domainName>>", "<<password>>");
{
   ChromeDriver driver = new ChromeDriver();
   driver.Navigate().GoToUrl("<<websiteUrl>>");
}

Impersonator class library can be found from Microsoft site.

If you are facing issue regarding domain certificate, then you can add Options in webdriver to bypass such errors.