Selenium With Java and Python For Mobile Apps & Web Apps......!

Sunday, 11 January 2015

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);

3 comments:

Translate

Popular Posts

Total Pageviews