setup of project in web driver

20
Raghav Arora : aroraglobalservices.blogspot.com How to Configure Selenium WebDriver (Java) 1

Upload: raghav-arora

Post on 20-Aug-2015

1.779 views

Category:

Education


1 download

TRANSCRIPT

Page 1: Setup of project in web driver

Raghav Arora : aroraglobalservices.blogspot.com

How to Configure Selenium WebDriver (Java)

1

Page 2: Setup of project in web driver

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

Page 3: Setup of project in web driver

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

Page 4: Setup of project in web driver

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

Page 5: Setup of project in web driver

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

Page 6: Setup of project in web driver

Create a Project

Right Click in your project > Properties

March 29, 2014

6

How to Configure Selenium WebDriver (Java) | Raghav Arora

aroraglobalservices.blogspot.com

Page 7: Setup of project in web driver

Create a Project

Java Build Path > Libraries

March 29, 2014

7

How to Configure Selenium WebDriver (Java) | Raghav Arora

aroraglobalservices.blogspot.com

Page 8: Setup of project in web driver

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

Page 9: Setup of project in web driver

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

Page 10: Setup of project in web driver

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

Page 11: Setup of project in web driver

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

Page 12: Setup of project in web driver

Configure Firefox

Google opens through Firefox

March 29, 2014

12

How to Configure Selenium WebDriver (Java) | Raghav Arora

aroraglobalservices.blogspot.com

Page 13: Setup of project in web driver

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

Page 14: Setup of project in web driver

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

Page 15: Setup of project in web driver

Configure Chrome

Google opens through Chrome

March 29, 2014

15

How to Configure Selenium WebDriver (Java) | Raghav Arora

aroraglobalservices.blogspot.com

Page 16: Setup of project in web driver

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

Page 17: Setup of project in web driver

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

Page 18: Setup of project in web driver

Configure Internet Explorer

Google opens through IE

March 29, 2014

18

How to Configure Selenium WebDriver (Java) | Raghav Arora

aroraglobalservices.blogspot.com

Page 19: Setup of project in web driver

Code : Cross Browser

Complete code

March 29, 2014

19

How to Configure Selenium WebDriver (Java) | Dasun Eranthika

aroraglobalservices.blogspot.com

Page 20: Setup of project in web driver

20

“Back to Journey..”

I’m on….

March 29, 2014 How to Configure Selenium WebDriver (Java) | Raghav Arora

aroraglobalservices.blogspot.com