When we test some sites, we might get SSL Certificate errors and it will be annoying for the Automation testers. They need to manually click on Add Exception which doesn't help when we go for executing Automation regression packs. Its not possible for the tester to click on Add Exception each and every time the critificate error pops up. The reason for getting this certicate error is that RC creates new Firefox profile every time the scripts gets executed.
We have some workarounds for handling these errors in Firefox and IE.
Firefox:
For Firefox, we have two workarounds.
First Workaround:
When you start your Selenium server, you need to add one parameter
java -jar selenium-server-standalone-2.2.0.jar
We should not allow Selenium RC to create a new Firefox profile every time. Instead we can create a dedicated profile and ask Selenium RC to use that every time. Follow the below steps:
1) Close all Firefox windows opened.
2) Go to cmd prompt and C:\Program Files\Mozilla Firefox>
3) From Mozilla folder, open Firefox Profile manager using this command, firefox -ProfileManager
4) Create a new profile for Selenium in ProfileManager dialog box and select the folder C:\Profile.
5) Choose that profile and click on Start Firefox.
6) Once Firefox loads, open the page which gives certificate error and add the exception manually.
7) Close your firefox session.
8) Now start the selenium server with the following command:
java -jar selenium-server-standalone-2.2.0.jar -firefoxProfileTemplate C:\Profile
The server will be started with the Firefox profile which you have created. When we execute our scripts, server will launch that Firefox profile.
Internet Explorer:
For Internet Explorer browser, it will be simple and easy. We need to add a small code just after selenium.open() statement.
Ex:
@Test
public void testMethod()
{
selenium.open(url);
if (selenium.isElementPresent("overridelink"))
{
selenium.click("overridelink");
Thread.sleep(30000);
}
....................................
...................................
}
We have some workarounds for handling these errors in Firefox and IE.
Firefox:
For Firefox, we have two workarounds.
First Workaround:
When you start your Selenium server, you need to add one parameter
-trustAllSSLCertificates which will make your Selenium server as proxy for Firefox browser session. Then, it can easily handle any HTTPS website.
java -jar selenium-server-standalone-2.2.0.jar
-trustAllSSLCertificates
Second Workaround:
We should not allow Selenium RC to create a new Firefox profile every time. Instead we can create a dedicated profile and ask Selenium RC to use that every time. Follow the below steps:
1) Close all Firefox windows opened.
2) Go to cmd prompt and C:\Program Files\Mozilla Firefox>
3) From Mozilla folder, open Firefox Profile manager using this command, firefox -ProfileManager
4) Create a new profile for Selenium in ProfileManager dialog box and select the folder C:\Profile.
5) Choose that profile and click on Start Firefox.
6) Once Firefox loads, open the page which gives certificate error and add the exception manually.
7) Close your firefox session.
8) Now start the selenium server with the following command:
java -jar selenium-server-standalone-2.2.0.jar -firefoxProfileTemplate C:\Profile
The server will be started with the Firefox profile which you have created. When we execute our scripts, server will launch that Firefox profile.
Internet Explorer:
For Internet Explorer browser, it will be simple and easy. We need to add a small code just after selenium.open() statement.
Ex:
@Test
public void testMethod()
{
selenium.open(url);
if (selenium.isElementPresent("overridelink"))
{
selenium.click("overridelink");
Thread.sleep(30000);
}
....................................
...................................
}
I am new to log4j log file anybody explain detailed about how to save all scripts logs.
ReplyDeletefor certificate error see selenium link
ReplyDeleteSWIFT Interview questions on
http://testwithus.blogspot.in/p/swift.htm
For selenium solution visit
http://testwithus.blogspot.in/p/blog-page.html
Try this one for Profile setup
ReplyDeletehttp://bugreaper.blogspot.in/2013/09/setting-up-profile-in-firefox-and.html
Thanks for the great information in your blog Selenium Training
ReplyDeleteGreat Blog..
ReplyDeleteThanks for Sharing this useful information amazing blog, It's help to know about the Selenium Certification and importance of Selenium ...