About The GeckoDriver And Its Use In Selenium Project

Posted By : Kuldeep Sidana | 19-Aug-2018

What is Gecko?

It is a web Browser engine. The several application developed Mozilla corporation and the Mozilla foundation are required the Gecko. Gecko is written in JavaScript and C++. And its latest version is written in Rust. Gecko is an open source and free web browser engine.  

About the Web Browser Engine?

Web Browser Engine is simply a software program. The main work of this program is to collect the content (like HTML, XML, images) & then format the information (like CSS) and display this formatted piece of content on the screen. Web Browser Engine is also called as Rendering Engine or Layout Engine.

 Applications like email clients, online help systems, Web browsers, e-book readers etc. need to display the web content, So for this, the web browser engine is required and Web browser engine is a part of all these kind of applications. Following are the different web browser engines for the web browsers.

The following table shows what web browser engines use by the web browsers.

 What is GeckoDriver?

GeckoDriver is work as a connecting link to the Firefox browser for Selenium Scripts. It is nothing but a proxy which it provides HTTP API to communicate with the Gecko-based browsers (e.g. Firefox).

 

Why does Selenium need GeckoDriver?

For Selenium3 we need
geckodriver to launch the browser Firefox (version 47 and above). Selenium3 has the Marionette Driver Using the proxy(GeckoDriver)it can directly interact with the browsers.

In one of my last blocg "https://my.oodles.io/blog/showEntry?title=Launching+Firefox+Browser+Using+Geckodriver+By+Selenium" I have defined how geckodriver work using setProperty method (Key,Value ). After successfully download the geckodriver we need to save it in the project and use its path.

Code to launch the browser using geckodriver.

             import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
publicclass First_Class {

publicstaticvoid main(String[] args) {

System.setProperty("webdriver.gecko.driver","E:\\GekoDriver\\geckodriver-v0.15.0-win64\\geckodriver.exe");

WebDriver driver=new FirefoxDriver();
driver.get("https://www.google.com/");
driver.manage().window().maximize();
String appTitle=driver.getTitle();
String expTitle="Google";
if (appTitle.equals (expTitle)){
System.out.println("Verification Successfull");
}
else{
System.out.println("Verification Failed");

}
driver.close();
System.exit(0);
}
}
   
        
Related Tags

About Author

Author Image
Kuldeep Sidana

Kuldeep Sidana is an orient QA Engineer having dexterity in Core Java and vouched with Automation Testing tool (Selenium Web Driver) and Manual Testing.

Request for Proposal

Name is required

Comment is required

Sending message..