Wednesday, 27 February 2019

Challenges to face run selenium sripts in IE Browser


Challenges to face run selenium sripts in IE Browser
1)Path of the IE Driver
The path to the driver executable must be set by the webdriver.ie.driver system property; for more information, see http://code.google.com/p/selenium/wiki/InternetExplorerDriver. The latest version can be downloaded from http://selenium-release.storage.googleapis.com/index.html
Class IE
{
Public static void main(String args[])
{
WebDriver t=new InternetExplorerDriver();
t.get(“”);
}
}



This Error happened because of there is no third browser in your system,you have to download the IE third party browser from the site seleniumhq.org
Filename:IEDriverServer.exe 32 bit or 64 bit




public class IE {

public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("webdriver.ie.driver","D:\\IEDriverServer_x64_3.14.0\\IEDriverServer.exe");
WebDriver t=new InternetExplorerDriver();
t.get("https://www.seleniumhq.org/");


}

}
Output:After set the third party browser in the path

2)Enable the Proteted Mode:
How to set the Protected Mode settings in IE Browser
1) Go to Tools > Internet Options and Under Internet Options click on the Security tab.
2) Click on the Internet zone to Select a zone and to view its Protected Mode property.
3) Now check the Enable Protected Mode check-box. Enable the Protected now.

Note:Does not Enable the Protected mode , when you try to run the program it show the error in your console window



3)Untrusted SSL Certifiate
IE is most secured browser at time using IE browser with selenium it gives SSL certificate popup
To resolve the issue handled in two ways:


Solution1:

public class IE {

public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("webdriver.ie.driver","D:\\IEDriverServer_x64_3.14.0\\IEDriverServer.exe");
WebDriver t=new InternetExplorerDriver();
t.get("https://www.seleniumhq.org/");
t.navigate().to("javascript:document.getElementById('overridelink').click()");


}

}

Solution 2:
Desiried Capabilities:

public class IE {

public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("webdriver.ie.driver","D:\\IEDriverServer_x64_3.14.0\\IEDriverServer.exe");
DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();

// Settings to Accept the SSL Certificate in the Capability object
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);

WebDriver t=new InternetExplorerDriver();
t.get("https://www.seleniumhq.org/");
t.navigate().to("javascript:document.getElementById('overridelink').click()");


}

}


No comments:

Post a Comment