Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to explicitly specify a path to Firefox for Selenium?

I got Selenium IDE, followed this post, got to

python test_default_server.py

and it complains Firefox is not in my path:

Please add the directory containing ''firefox.exe'' to your PATH environment
variable, or explicitly specify a path to Firefox 3 like this:
*firefox3c:\blah\firefox.exe

I could change my PATH environment variable, but I'd rather pursue the local config option they are mentioning ("explicitly specify a path"). How do I do that? What does the "*firefox3c" refer to?

Selenium 1.0.1, Python 2.5, Windows XP.

like image 916
dfrankow Avatar asked Aug 27 '09 22:08

dfrankow


People also ask

Which property should be set to run Firefox browser in Selenium?

Generally to run tests on our local machine, we will just specify as WebDriver driver = new FirefoxDriver(); to run on Firefox browser. System. setProperty("webdriver. gecko.


2 Answers

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()
like image 187
Santi Avatar answered Nov 15 '22 17:11

Santi


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.

like image 32
Pallavi Avatar answered Nov 15 '22 15:11

Pallavi