Raghav Arora : aroraglobalservices.blogspot.com How to Configure Selenium WebDriver (Java) 1
Aug 20, 2015
Raghav Arora : aroraglobalservices.blogspot.com
How to Configure Selenium WebDriver (Java)
1
Content
Create a Project
Configure Firefox
Configure Chrome
Configure Internet Explorer
You must pre-download eclipse
March 29, 2014
2
How to Configure Selenium WebDriver (Java) |Raghav Arora
aroraglobalservices.blogspot.com
Create a Project
Open eclipse
Right click on Package Explorer > New > Java Project
March 29, 2014
3
How to Configure Selenium WebDriver (Java) | Raghav Arora
aroraglobalservices.blogspot.com
Create a Project
Give a Project name and click Next
March 29, 2014
4
How to Configure Selenium WebDriver (Java) | Raghav Arora
aroraglobalservices.blogspot.com
Create a Project
Go to Selenium downloads page and download Java Language bindings
Extract it in your local drive
March 29, 2014
5
How to Configure Selenium WebDriver (Java) | Raghav Arora
aroraglobalservices.blogspot.com
Create a Project
Right Click in your project > Properties
March 29, 2014
6
How to Configure Selenium WebDriver (Java) | Raghav Arora
aroraglobalservices.blogspot.com
Create a Project
Java Build Path > Libraries
March 29, 2014
7
How to Configure Selenium WebDriver (Java) | Raghav Arora
aroraglobalservices.blogspot.com
Create a Project
Click “Add Library..” button and add JAR files (include files in “libs” folder)
March 29, 2014
8
How to Configure Selenium WebDriver (Java) | Raghav Arora
aroraglobalservices.blogspot.com
Create a Project
After import JAR files, you can see “Referenced Libraries” folder
March 29, 2014
9
How to Configure Selenium WebDriver (Java) | Raghav Arora
aroraglobalservices.blogspot.com
Configure Firefox
Create new class file and enter following code
March 29, 2014
10
How to Configure Selenium WebDriver (Java) | Raghav Arora
import org.openqa.selenium.firefox.FirefoxDriver; public class Uers { public static void main(String[] args) { FirefoxDriver fd = new FirefoxDriver(); fd.get("http:/google.lk"); } }
Site URL
aroraglobalservices.blogspot.com
March 29, 2014 How to Configure Selenium WebDriver (Java) | Dasun Eranthika
11
> Open eclipse
> Right click on Package Explorer > New > Java Project
> Give a Project name and click Next
> Go to Selenium downloads page and download Java Language bindings
> Extract it in your local drive
> Right Click in your project > Properties
> Java Build Path > Libraries
> Click “Add Library..” button and add JAR files (include files in “libs” folder)
> After import JAR files, you can see “Referenced Libraries” folder
Configure Firefox
Google opens through Firefox
March 29, 2014
12
How to Configure Selenium WebDriver (Java) | Raghav Arora
aroraglobalservices.blogspot.com
Configure Chrome
Download chrome driver from selenium download page third party section
and extract it
March 29, 2014
13
How to Configure Selenium WebDriver (Java) | Raghav Arora
aroraglobalservices.blogspot.com
Configure Chrome
Enter following code
March 29, 2014
14
How to Configure Selenium WebDriver (Java) | Raghav Arora
import org.openqa.selenium.chrome.ChromeDriver; public class Uers { public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "C:\\Selenium\\chromedriver.exe"); ChromeDriver cd= new ChromeDriver(); cd.get("http://google.lk"); } }
Site URL
Location of chromedriver
aroraglobalservices.blogspot.com
Configure Chrome
Google opens through Chrome
March 29, 2014
15
How to Configure Selenium WebDriver (Java) | Raghav Arora
aroraglobalservices.blogspot.com
Configure Internet Explorer
Download Internet Explorer (IE) driver from selenium download page and
extract it.
March 29, 2014
16
How to Configure Selenium WebDriver (Java) | Raghav Arora
aroraglobalservices.blogspot.com
Configure Internet Explorer
Enter following code
March 29, 2014
17
How to Configure Selenium WebDriver (Java) | Raghav Arora
import org.openqa.selenium.ie.InternetExplorerDriver; public class Uers { public static void main(String[] args) { System.setProperty("webdriver.ie.driver", "C:\\Selenium\\IEDriverServer.exe"); InternetExplorerDriver id= new InternetExplorerDriver(); id.get("http://google.lk"); } }
Site URL Location of IEdriver
aroraglobalservices.blogspot.com
Configure Internet Explorer
Google opens through IE
March 29, 2014
18
How to Configure Selenium WebDriver (Java) | Raghav Arora
aroraglobalservices.blogspot.com
Code : Cross Browser
Complete code
March 29, 2014
19
How to Configure Selenium WebDriver (Java) | Dasun Eranthika
aroraglobalservices.blogspot.com
20
“Back to Journey..”
I’m on….
March 29, 2014 How to Configure Selenium WebDriver (Java) | Raghav Arora
aroraglobalservices.blogspot.com