When I run the selenium RC script, I am getting Failed to start new browser, Firefox 3 could not be found in the path!
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.thoughtwo开发者_如何学运维rks.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
There are two ways to fix this using firefox:
Add the firefox path into Envirometal variable PATH such as
E:\Program files\mozilla firefox\firefox.exe
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")
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
.
Specify the absolute path to the Firefox executable directory (with a space between the brower name and the path): *firefox /path/to/dir
Try giving absolute path to firefox.exe in DefaultSelenium
Selenium selenium = new DefaultSelenium("localhost",5555,"*custom /path/to/firefox.exe", "http://url");
I got the same error earlier. But I browsed and found the updated selenium server jar file.
This way I fixed my problem.
I had the same problem, caused by the fact that on the particular VM
I'm working on, there's no room to put anything else on the C:
drive so I'm using E:
instead.
What I did was edited the path in "System -> Advanced -> Environment Variables"
to contain:
E:\Program Files\Mozilla Firefox
as this is where I installed Firefox
. Whether this is the best solution or not I don't know, but it got selenium to work.
I could resolve the issue in Windows 7 by modifying the system variable: path
1> modify the system variables -- Path.
For Windows 7: {Assuming that the firefox.exe file is located in the directory: C:\Program Files (x86)\Mozilla Firefox\firefox.exe}
Computer(right click) --> Properties --> Advanced System Settings -->Environment Variables --> system variables --> path --> double click it --> edit system variable(pop up)
Go to the end of the variable value Add a semicolon; if it does not exist;
add the string: *firefox(give a blank space) Path to the directory that contains the firefox.exefile. Do not add firefox.exe in the path.
*example: EXISTING_PATH;*firefox C:\Program Files (x86)\Mozilla Firefox*
Another way to resolve the issue is: (Caution: I use old selenium jar. variable/filename could mismatch)
The SeleniumSystemObject class contains the webBrowser parameter. It either picks up the value from the environment variable or it can be supplied with the absolute path.
Edit the variable 'webBrowser' in the class SeleniumSystemObject to supply the absolute path for the firefox web browser in the value of webBrowser parameter as: example: private String webBrowser = "*firefox C:\Program Files (x86)\Mozilla Firefox\firefox.exe";
Had the same problem and tried all the solutions mentioned above. PATH in system variable, a separate user variable. Still problem wasn't solved, in the end it boiled down to firefox not being my default webrowser.
The option in Eclipse, Window->Preferences->General->WebBrowser was set to - use internal webbrowser and default system web browser. Hence all the problem. Once changed to firefox it started working.
Wasted almost 2 hours trying to figure it out, couldn't even find this online. So found it worthwhile to post here. :)
I've gotten the same error when I've tried run my tests using the selenium-server-standalone-2.44.0.jar file. I've changed to selenium-server-standalone-2.39.0.jar file and my tests is running perfectly.
I'm using the source code bellow:
@Before
public void setUp() throws Exception {
selenium = new DefaultSelenium("localhost", 4444, "*chrome", "myURL");
selenium.start();
}
This code is starting my firefox even using "*chrome" in the DefaultSelenium method as parameter.
I suggest you to use maven.Then it would be way easier. Firefox comes with selenium library. You just need to initialize the selenium jar into the project.Then you can use this expression.
Webdriver driver = new FirefoxDriver();
Here you can find the jar.
http://selenium-release.storage.googleapis.com/2.44/selenium-server-standalone-2.44.0.jar
Try installing the 32-bit version of Firefox 42.0. That was the issue for me; the 64-bit version wasn't found, but 32-bit was.
精彩评论