Handle SSL Certificate Error In Google Chrome When Run Test In Selenium

You already know how to execute selenium webdriver exam In Google chrome browser every bit nosotros learnt It In THIS POST. You are every bit good well aware most how to handle SSL Certificate Error In Mozilla Firefox browser past times creating custom profile every bit described In THIS POST as well as In IE browser using driver.navigate() method as described In THIS POST. Now supposing y'all wants to run your exam In google chrome browser as well as necessitate to handgrip SSL Certificate Error. Any Idea How to produce It?

Handling SSL certificate fault In google chrome browser on selenium WebDriver exam execution Is hence uncomplicated as well as easy. Here nosotros tin purpose desired capabilities to acquire as well as bring SSL certificate on run-time using bellow given syntax.

//Set chrome browser's capabilities to to bring SSL certificate on runtime. DesiredCapabilities capability = DesiredCapabilities.chrome(); capability.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);

Now If y'all volition launch Google Chrome browser using newly laid capability as well as opened upward URL where SSL certificate fault display as well as hence It volition bring SSL certificate automatically as well as launch site URL without whatever error.

Practical example to present how to handgrip SSL certificate fault Is every bit bellow. Execute bellow given example In eclipse (If y'all cause got whatever URL where SSL certificate fault appear) as well as bring out result.

package Testing_Pack;  import java.util.concurrent.TimeUnit;  import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.remote.CapabilityType; import org.openqa.selenium.remote.DesiredCapabilities;  world cast SSLErrorInChrome {   world static void main(String[] args) {    //Set chrome browser's capabilities to to bring SSL certificate on runtime.   DesiredCapabilities capability = DesiredCapabilities.chrome();   capability.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);   System.setProperty("webdriver.chrome.driver", "D:\\chromedriver_win32\\chromedriver.exe");    WebDriver driver = novel ChromeDriver(capability);   driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);      //Enter the URL of site where y'all facing SSL error.   driver.get("Enter site URL");  } }

It volition handgrip certificate related fault as well as run your exam smoothly. I cause got used higher upward method In many of my sites as well as plant fine for me.

More interesting articles here :Generation Enggelmundus Internet Marketing Tool here :Zeageat IM http://www.software-testing-tutorials-automation.com/
Post a Comment (0)
Previous Post Next Post