- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Why GeckoDriver is used in selenium?
The geckodriver can be used in Selenium webdriver. For the Mozilla version above 47, the geckodriver is used due to the presence of Marionette, which is the driver for automation in Mozilla. We can then launch the Firefox browser by instantiating an object of FirefoxDriver class with the help of the below statement.
WebDriver driver=new FirefoxDriver();
Next we have to download the geckodriver and configure it to our project by following the below step by step processes −
Navigate to the link −https://www.selenium.dev/downloads/ and move below the Browser section, there will be Firefox text present. Click on the Documentation link just below that.
All the geckodriver versions which are compatible with the corresponding Selenium versions shall be listed there.
Click on the geckodriver releases link.
Next we have to download the geckodriver as per our system operating system.
After downloading the geckodriver, a zip file gets created. We need to extract that and save the geckodriver.exe file at any location.
Let us now discuss how to configure geckodriver with System properties within the Selenium code −
Add the System.setProperty method in the code which takes the browser type and the path of the geckodriver executable path as parameters.
System.setProperty("webdriver.gecko.driver","<geckodriver path>");
Example
Code Implementation
import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class LaunchFirefoxBrowser{ public static void main(String[] args) { // creating object of FirefoxDriver WebDriver driver = new FirefoxDriver(); // to configure the path of the geckodriver.exe System.setProperty("webdriver.gecko.driver", "C:\Users\ghs6kor\Desktop\Java\geckodriver.exe"); String url = "https://www.tutorialspoint.com/index.htm"; driver.get(url); } }
- Related Articles
- Why Selenium IDE is not used for dynamic Website testing?
- Why Selenium RC is deprecated?
- Why is Python used in Blockchain?
- Why Abstract Class is used in Java?
- Why is aluminium used in making aeroplanes ?
- What is Selenium and why is it chosen extensively?
- What is the command used to register gecko driver in Selenium?
- Why salt is used for preservation?
- Why is Python used for hacking?
- Why is Python used on YouTube?
- Why is only mercury used in a thermometer?
- Why is parallel arrangement used in domestic wiring?
- What is CSS and why it is used?
- Give reasons, why :Silver is used in jewellery.Copper is used in electrical wiring.Sodium is stored in kerosene oil.
- Why is the term "Bachelor" used in educational qualifications?
