5

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?

user1700354
  • 107
  • 2
  • 3
  • 15

7 Answers7

5

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]

Community
  • 1
  • 1
Subh
  • 4,354
  • 1
  • 13
  • 32
3

In my enviroment I set the property -Dwebdriver.firefox.bin="C:\Mozilla Firefox\firefox.exe"

kdoteu
  • 1,527
  • 1
  • 20
  • 26
1

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();
akash
  • 22,664
  • 11
  • 59
  • 87
1

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();
1

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.

0

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();
grasshopper
  • 3,988
  • 3
  • 23
  • 29
0
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
Sanjay Kumar
  • 369
  • 6
  • 23