user1787641
user1787641

Reputation: 331

How to tell Firefox to run on particular version in Selenium webdriver?

I want to run my tests on diff versions of Firefox installed on my machine by mentioning the respective versions, I read this link https://stackoverflow.com/questions/12596097/how-to-set-particular-firefox-version-in-selenium-webdriver, but i dont want to create profiles manually and pass the same, is their any way on the run time to decide which version to pick??

Upvotes: 3

Views: 2801

Answers (2)

Nabin
Nabin

Reputation: 11776

And for those using python use FirefoxBinary

Specify path to firefox binary using FirefoxBinary:

from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary

browser = webdriver.Firefox(firefox_binary=FirefoxBinary('path goes here'))

Hope it helps someone :)

Upvotes: 0

Pavel Janicek
Pavel Janicek

Reputation: 14748

Try using FirefoxBinary class when setting up the WebDriver.

For example: I assume you have FF 15 installed in C:\testing\ff15\firefox.exe

Then, before setting up the webDriver do this:

 File pathToBinary = new File("C:\\testing\\ff15\\firefox.exe");
 FirefoxBinary binary = new FirefoxBinary(pathToBinary);
 FirefoxDriver driver = new FirefoxDriver(binary, new FirefoxProfile());

I never tried it, but I think it should work

Upvotes: 4

Related Questions