Hi I am very new to selenium . So pardon me for any technical mistakes. I have a project which works fine for IE. But I need to test using firefox too. Does the project require a pointer towards the driver like IEDriver in case of execution in IE?
-
You might want to improve the question somewhat, i.e. what did you do and what went wrong / what happened? (if applicable) – Tilman Hausherr Jan 06 '15 at 10:05
7 Answers
You don't need to set the driver path for FirefoxDriver.
You can directly use WebDriver driver = new FirefoxDriver();
.
However, there are other ways to run selenium in Firefox also, as below:
1- Using Firefox Profile;
Used to run selenium in a new user-defined profile with a set of preferences as necessary.
2- Using Firefox Binary;
[PS:- Not much Idea on how it works, But this link might help you out]
-
-
I am assuming, you mean setting up of the Driver property. Yes, it is [done for Chrome](http://stackoverflow.com/a/13729517/4193730). – Subh Jan 09 '15 at 06:31
-
1
-
True.. This answer was for an older version of selenium. Now, we need to set up system property from Selenium 3 as geckodriver is in play for Firefox browser – Subh May 21 '20 at 11:38
In my enviroment I set the property -Dwebdriver.firefox.bin="C:\Mozilla Firefox\firefox.exe"

- 1,527
- 1
- 20
- 26
For testing with FireFox
you can directly use driver = new FirefoxDriver()
or you can download selenium driver for ie from this link and set path property as stated below.
System.setProperty("webdriver.ie.driver", "pathToTheIEDriver");
WebDriver driver = new InternetExplorerDriver();

- 22,664
- 11
- 59
- 87
If we want to run the test case of Firefox then we need GeckoDriver. Use below link for downloading the latest geckodriver: https://github.com/mozilla/geckodriver/releases
Save the driver inside your project repository in a folder (you can give any name to the folder, i have used "BrowserDriver"). Use below code for calling the driver:
System.setProperty("webdriver.gecko.driver", System.getProperty("user.dir")+"/BrowserDriver/Mac/geckodriver 2");
WebDriver driver = new FirefoxDriver();

- 49
- 3
Many of you might get the error in creating path to geckodriver or firefox-driver it's very easy just follow this way:
from selenium import webdriver
path = "home/sysname/Desktop/geckodriver"
driver = webdriver.Firefox(executable_path = path)
Notice that you have to write executable_path=path and then give path variable name.

- 11
- 3
You just need to create a WebDriver that is an instance of Firefox, like so:
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
WebDriver driver = new FirefoxDriver();

- 3,988
- 3
- 23
- 29
import org.openqa.selenium.WebElement;//import this package
import org.openqa.selenium.By; //import this package
WebDriver FF_river = new FirefoxDriver();//create a reference variable of FirefoxDriver() int

- 369
- 6
- 23
-
1you should add an explanation along with your answer to explain why OP should implement your solution. – JSK NS Jan 06 '15 at 10:51
-
yes its require a webdriver for and instance to firefox, thats why you have to import these package and a reference variable – Sanjay Kumar Jan 06 '15 at 11:00
-