How to explicitly specify a path to Firefox for Selenium? How to explicitly specify a path to Firefox for Selenium? selenium selenium

How to explicitly specify a path to Firefox for Selenium?


You have to use the following string when you instantiate selenium instead of just "*firefox":

"*firefox C:\\Program Files\\Mozilla Firefox\\firefox.exe"

Notice: I'm not sure that path is correct, but it should be a similar one.

Update: Where do you instantiate your browser?By the tags in the question I suppose you're a python guy:

def setUp(self):    self.verificationErrors = []    self.selenium = selenium("localhost", 4444, "*firefox C:\\Program Files\\Mozilla Firefox\\firefox.exe", "http://change-this-to-the-site-you-are-testing/")    self.selenium.start()


If on C# editor, use the following string:

selenium = new DefaultSelenium("localhost", 4444, "*firefox C:\\Program Files\\firefox.exe", "http://www.google.com/");

Note: use an extra back slash before Program Files and firefox.exe, since a single backslash becomes an unrecognized escape sequence.


This helps very much. setUp("http://localhost:8080/BingDemo/BingDriver.html", "*firefox C:\Program Files (x86)\Mozilla Firefox\firefox.exe");

However, replace all occurrences of \ with \\ in *firefox C:\Program Files (x86)\Mozilla Firefox\firefox.exe

Additionally, you could point your PATH to in environmental variables to mozilla.exe