Sometimes, When yous access site manually In browser It volition plant fine but shows "This Connection is Untrusted" fault when yous access same URL through webdriver. So what Is the argue behind this Issue? It Is working fine In default organization browser because yous already Imported
required certificate In that browser. That fault volition non look 1 time yous Import required certificate In browser. But equally yous know, Selenium webdriver opens fresh profile every fourth dimension yous run exam thus that browser exercise non accept required SSL certificate.
required certificate In that browser. That fault volition non look 1 time yous Import required certificate In browser. But equally yous know, Selenium webdriver opens fresh profile every fourth dimension yous run exam thus that browser exercise non accept required SSL certificate.
So how to handle this SSL certificate error In webdriver? If yous know, We tin privy exercise Firefox profile manually in addition to and thus nosotros tin privy role It In webdriver test. Steps to resolve SSL certificate Issue are equally bellow.
Step 1 : Create novel firefox profile alongside cite = "certificateIssue". VIEW STEPS to exercise firefox profile.
Step 2 : Start browser using that "certificateIssue" profile manually.
Step 3 : Access the URL In which yous are getting SSL certificate error. It volition exhibit yous "This Connection is Untrusted" error.
Step 4 : Import certificate past times clicking on I Understnad the Risks -> Add Exception button. So fault volition disappear in addition to URL volition live on opened In novel profile browser.
Step 5 : Create webdriver script in addition to access novel created "certificateIssue" profile In firefox driver equally bellow.
package Testing_Pack; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.firefox.FirefoxProfile; import org.openqa.selenium.firefox.internal.ProfilesIni; populace class sslError { populace static void main(String[] args) { //Access firefox browser profile "certificateIssue" to role It In test. ProfilesIni firProfiles = novel ProfilesIni(); FirefoxProfile wbdrverprofile = firProfiles.getProfile("certificateIssue"); wbdrverprofile.setAcceptUntrustedCertificates(true); wbdrverprofile.setAssumeUntrustedCertificateIssuer(false); WebDriver Driver = novel FirefoxDriver(wbdrverprofile); Driver.get("site URL where certificate error"); } }
Now your site volition live on accessed without whatever Issue when yous run test. You tin privy sentiment THIS POST to know how to handgrip SSL certificate fault inwards IE browser in addition to THIS POST to know how to handgrip SSL certificate fault inwards chrome browser inwards webdriver test.
http://www.software-testing-tutorials-automation.com/