Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When I run the selenium RC script, I am getting Failed to start new browser, Firefox 3 could not be found in the path!

Tags:

selenium-rc

When I run the script, I am getting the below error...

I have pasted the firefox location in to system variable path...
still i am getting the below error :

java.lang.RuntimeException: Could not start Selenium session: Failed to start new browser session: java.lang.RuntimeException: Firefox 3 could not be found in the 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
at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:89)
at com.example.tests.flightbooking.setUp(flightbooking.java:13)
at junit.framework.TestCase.runBare(TestCase.java:128)
at com.thoughtworks.selenium.SeleneseTestCase.runBare(SeleneseTestCase.java:212)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: com.thoughtworks.selenium.SeleniumException: Failed to start new browser session: java.lang.RuntimeException: Firefox 3 could not be found in the 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
at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:97)
at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:91)
at com.thoughtworks.selenium.HttpCommandProcessor.getString(HttpCommandProcessor.java:262)
at com.thoughtworks.selenium.HttpCommandProcessor.start(HttpCommandProcessor.java:223)
at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:81)
... 16 more
like image 395
ChanGan Avatar asked Mar 12 '11 12:03

ChanGan


2 Answers

There are two ways to fix this using firefox:

  1. Add the firefox path into Envirometal variable PATH such as

    E:\Program files\mozilla firefox\firefox.exe

  2. Add the absolute path in the test script like:

    selenium = new DefaultSelenium("localhost", 4444, "*firefox E:\\Program files\\mozilla firefox\\firefox.exe", "http://testWebsite.com")

like image 94
Michael Lai Avatar answered Sep 21 '22 14:09

Michael Lai


If you tests Google Chrome and you use *chrome as browser in your tests then this discussion is useful:

How to run Google Chrome with Selenium RC?

Spoiler: Change *chrome to *googlechrome.

like image 25
Martin Vseticka Avatar answered Sep 23 '22 14:09

Martin Vseticka