- 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
What is the command used to register gecko driver in Selenium?
We can register a gecko driver with Selenium webdriver. For the Firefox versions greater than 47, we can execute tests in Firefox with the geckodriver.exe file. To download this executable file, visit the below link − https://github.com/mozilla/geckodriver/releases
Next, we have to choose the link of the zip file which is compatible with our local operating system. As the download of the zip file is done, it has to be extracted and the file – geckodriver.exe should be saved in a location.
To register this geckodriver.exe file, we have to set the path of the geckodriver.exe file with the System.setProperty method. Also we have to create an instance of the FirefoxDriver class.
WebDriver driver = new FirefoxDriver();
Syntax
System.setProperty("webdriver.gecko.driver", "<path of geckodriver.exe>");
Example
import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import java.util.concurrent.TimeUnit; public class RegGecko{ public static void main(String[] args) { System.setProperty("webdriver.gecko.driver", "C:\Users\ghs6kor\Desktop\Java\geckodriver.exe"); WebDriver driver = new FirefoxDriver(); //implicit wait driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS); //URL launch driver.get("https://www.tutorialspoint.com/index.htm"); String t = driver.getCurrentUrl(); System.out.println("Current URL is: " + t); //close browser driver.close(); } }
Output
- Related Articles
- Gecko driver, Selecting value from a dropdown list using Selenium
- What is Web Driver in Selenium?
- What is selenium web driver?
- What is Selenium Internet Explorer Driver or IE Driver?
- What is the Selenium Web Driver Architecture?
- How to use the gecko executable with Selenium?
- Is it mandatory to register the driver while working with JDBC?
- How to de-register a driver from driver manager’s drivers list using JDBC?
- What are the pre-conditions for Selenium Internet Explorer Driver or IE Driver?
- How many ways are there to register a driver in Java?
- What is MySQL TRUNCATE command used for?
- What is MySQL DROP command used for?
- What is MySQL DELETE command used for?
- How to get userAgent information in Selenium Web driver?
- How to change user agent for Selenium driver?

Advertisements