How to launch Diffrent-2 Browsers using Selenium WebDriver?
For Mozilla Firefox:
WebDriver driver=new FireFoxdriver();
Chrome:
System.setProperty("webdriver.chrome.driver","E:\\SOFTWARES\\chromedriver.
exe");// path of chrome server for Webdriver
WebDriver d=new ChromeDriver();
Internet Explorer:
Step 1: Please include below code in a class, code should be before creating an
object
System.setProperty("webdriver.ie.driver","C:\\Users\\IEDriverServer.exe");
WebDriver driver = new InternetExplorerDriver();
Dwonload IEDriverServer.exe from the below link and store it in your local
machine
(http://code.google.com/p/selenium/downloads/detail?name=IEDriverServer_x64_
2.29.0.zip&can=2&q)
IE need some security settings :
step 2 : (still if u are facing the problems , do the seetings below)
Open up your Internet Explorer settings tools-->Internet Option --> and have a
look at the Security tab. Is the “Enable Protected Mode” checkbox set to the same
value for all the zones
Safari:
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setBrowserName("safari");
CommandExecutor executor = new SeleneseCommandExecutor(new
URL("http://localhost:4444/"), new URL("http://www.google.com/"), capabilities);
WebDriver driver = new RemoteWebDriver(executor, capabilities);
WebDriver driver=new FireFoxdriver();
Chrome:
System.setProperty("webdriver.chrome.driver","E:\\SOFTWARES\\chromedriver.
exe");// path of chrome server for Webdriver
WebDriver d=new ChromeDriver();
Internet Explorer:
Step 1: Please include below code in a class, code should be before creating an
object
System.setProperty("webdriver.ie.driver","C:\\Users\\IEDriverServer.exe");
WebDriver driver = new InternetExplorerDriver();
Dwonload IEDriverServer.exe from the below link and store it in your local
machine
(http://code.google.com/p/selenium/downloads/detail?name=IEDriverServer_x64_
2.29.0.zip&can=2&q)
IE need some security settings :
step 2 : (still if u are facing the problems , do the seetings below)
Open up your Internet Explorer settings tools-->Internet Option --> and have a
look at the Security tab. Is the “Enable Protected Mode” checkbox set to the same
value for all the zones
Safari:
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setBrowserName("safari");
CommandExecutor executor = new SeleneseCommandExecutor(new
URL("http://localhost:4444/"), new URL("http://www.google.com/"), capabilities);
WebDriver driver = new RemoteWebDriver(executor, capabilities);
Great Post with valuable information. I am glad that I have visited this site. Share more updates
ReplyDeleteSelenium Testing Online
Excellant post keep sharing and worthy information.
ReplyDeleteAngularjs Training in Chennai
Angularjs Certification Online
Angularjs Training In Bangalore
Great post. Thanks for sharing such a useful blog.
ReplyDeletedot net training in OMR
Dot net training in Chennai