Home » Posts tagged 'gecko driver download'

Tag Archives: gecko driver download

Newly Updated Posts

First Test case Firefox (GeckoDriver with selenium)

How to write First Test case Firefox (GeckoDriver with selenium)?

After completing the installation process in previous topic, its time to execute First Test case Firefox (GeckoDriver with selenium) script to understand how GeckoDriver with Selenium works.

Whats is Gecko Driver?

Gecko Driver:When we talk about Gecko it is coined to Gecko web browser which is developed by Mozilla foundation. Gecko driver provides a bridge between selenium and Firefox browser.Gecko acts as proxy between W3C webdriver compatible client and Gecko based web browser.

Mechanism if GeckoDriver with browser

Higher version of Selenium ex (selenium3) uses Marionette for launch Firefox instead of default(Where .exe is not been provided).

Marionette works as default for selenium 3. Selenium uses W3C protocol for send request to gecko driver.

Download Gecko Driver with below steps:

  • To download Gecko driver click to Click Here , Click to the gecko driver link for the release compatible to you system config for ex(window, linux, IOS).
Download GeckoDriver in selenium
  • Once the geckodriver zip file is downloaded, unzip the file on you specific folder
Unzip geckoDriver in selenium
Unzip GeckoDriver in selenium

Now Create a New Java Project with below steps:

  • Open the Eclipse and select File->New->Project->Java Project
Create Java Project in Eclipse
  • Enter your project name SeleniumTutorial(mention any name) and then click to finish button at the bottom
First Test case Firefox (GeckoDriver with selenium)
  • Now create a new package Step->File->New->Package, A window will open enter package name (Selenium Architecture)(you can mention any name) and click to finish button.
First Test case Firefox (GeckoDriver with selenium)
  • After creating package eclipse project will be displayed on left pane.
First Test case Firefox (GeckoDriver with selenium)

Create a Class in package for this Right Click to you package(SeleniumArchitecture) ->New->Class button.

Creating class file for Java project GeckoDriver in selenium

  • Once you click to class , Class window will appear enter any name for class as(FirstTestScript) and check the check box for public static void main (as shown in picture).
Creating Script in GeckoDriver with selenium

Add Selenium Webdriver Jar (follow below steps)

  • Right click on the project Selenium Tutorial ->Build path->Configure build path.
Install GeckoDriver in selenium

  • Under Java Build path window->Click on libraries(Menu on top)->click on Add external jars (on right side) a window will open , go to the folder where selenium jar is kept and all the files from lib and outside the lib folder. Now click to apply and close
Setup GeckoDriver in selenium

  • Jars will be saved on your project.
Setup GeckoDriver in selenium

Setup gecko driver to environmental variable setting with below steps:

  • Go to My computer from your local, right click->select properties menu
Setup GeckoDriver in selenium

  • Click to Advanced system settings.
System setting for GeckoDriver in selenium

  • Click to Environment variable.
System setting for GeckoDriver in selenium

  • Under Environment variable window-> System setting-> select Path and click to edit button at bottom and add the location where the Gecko driver is placed after semi colon (we are using window 10 so add the location of gecko driver) and click to OK button as per screenshot.
System and environment setting for GeckoDriver in selenium

Now move to scrip and write below code:

GeckoDriver in selenium
  • Code2test be sharing you code for copy to your eclipse below.
package SeleniumArchitecture;
public class FirstTestScript {
public static void main(String[] args) {
    System.setProperty("webdriver.gecko.driver", "C:\\Users\\Tutorial\\Desktop\\Eclipse_Installer\\GeckoDriver\\geckodriver.exe");
     WebDriver driver = new FirefoxDriver();
     driver.get("http://www.facebook.com");

     Thread.sleep(5000);
     driver.quit();

}}

  • To remove error from line on FirefoxDriver(); just mouse over to it and click to import FirefoxDriver link . Do same with Webdriver and on Thread.sleep(add exception to it)
Test Script GeckoDriver in selenium

Now right click to you class file and click to Run as ->Java Project, Firefox browser will open and launch the facebook page.