What is Gecko Driver and its use in Selenium
Posted By : Anuj Gupta | 31-Oct-2018
What is Gecko?
Gecko is basically a web browser engine and many applications require Gecko. Mainly, applications developed by Mozilla Foundation and Mozilla Corporation use Gecko. Gecko used in many open source software projects. Gecko is written in JavaScript, C++, and Rust. It is an open source web browser engine.
What is
Web Browser Engine is just a software program and its main function is to collect the content (eg. XML, HTML, and Images) and formatting information (eg. CSS) and show the formatted information or content on the screen. Web browser engine is also known as Rendering Engine or Layout Engine.
Many applications like e-book readers, web browsers, and online help system etc. need to show the web content on the display and to show the content, web browser engine is required and it is an essential part of all these applications. Also, there are many different web browser engines for each web browsers.
Gecko runs on the following operating system:
- Windows
- Mac
- Linux
- Unix
The following table shows the web browsers with their web browser engines:
What is Gecko Driver?
Gecko Driver is the connecting link between the scripts in Selenium and the Firefox browser. Gecko Driver is a proxy which helps to interact with
Use of Gecko Driver
In Selenium 2.0. Firefox plug-ins are used to control the web browser. Web driver is a W3C (World Wide Web Consortium) like CSS, HTML, and JavaScript as this is the new standard which has many advantages.
W3C set some standards for the web driver. So, Mozilla Corporation implemented the web driver standard in its Marionette Driver which is popularly known as Gecko Driver which is used to simulate the actions in Firefox version 46 and above. Nowadays, many organizations like Microsoft implement their own web driver standard in their browsers.
Therefore, if we want to automate web application by using Firefox version and above, we need to use Gecko Driver.
Let's see an example to launch the Firefox browser by using Gecko Driver.
package Selenium;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class gecko {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("webdriver.gecko.driver", "//home//anuj//geckodriver");
WebDriver driver = new FirefoxDriver();
driver.get("https://www.google.com/");
//To get the web page title
String actualTitle=driver.getTitle();
String expectTitle="Google";
if (actualTitle.equals (expectTitle)){
System.out.println("Verification Successfull");
}
else{
System.out.println("Verification Failed");
}
driver.close();
}
}
If you liked this blog then share it with a friend.
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Anuj Gupta
Anuj is a passionate QA engineer and an optimistic person. He is fond of playing Chess and Basketball. He always comes up with the new ideas and is a good team player.