This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Testing and the fly likes Selenium - SystemRoot apparently not set Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Selenium - SystemRoot apparently not set" Watch "Selenium - SystemRoot apparently not set" New topic
Author

Selenium - SystemRoot apparently not set

Guy Roth
Ranch Hand

Joined: Aug 09, 2009
Posts: 74
I am trying to start Selenium on my testing machine.
in some of the running I get the error:
java.lang.RuntimeException: Could not start Selenium session: Failed to start new browser session: java.lang.RuntimeException: SystemRoot apparently not set!
at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:89)


And the test suite doesn't run - what could cause this error message?
James Dixon
Ranch Hand

Joined: Jun 20, 2009
Posts: 32
Looking through the selenium source code (here) you can see that the error is thrown if the the environment variable %systemroot% is not found.

As a 'Quick Fix' you could try adding the environment variable SystemRoot to point to the windows directory. But as this is something that windows provides it is a bit surprising that it cannot be found. Which version of windows are you working with?

Or for that matter are you testing on a windows box :-)
Guy Roth
Ranch Hand

Joined: Aug 09, 2009
Posts: 74
It is indeed weird because it used to work.

my env hoever is:
Microsoft Windows Server 2003
Enterprise x64 Edition
Service Pack 2
James Dixon
Ranch Hand

Joined: Jun 20, 2009
Posts: 32
I have to say I haven't worked on Win2003 before, but I can't imagine it would be any different...

Did you try adding the environment variable 'SystemRoot' to see if that managed to sort out the problem?
If not you could also drop down to the command prompt and type 'set' and press enter and see if 'SystemRoot' is listed.
Guy Roth
Ranch Hand

Joined: Aug 09, 2009
Posts: 74
I set the SystemRoot variable and it worked. but generally the tests triggered to start working by a windows daily schedular task.
I'll have to see if in the next scheduled time the Selenium test suite will run properly.
So I'll update this thread in the results tomorrow.
Guy Roth
Ranch Hand

Joined: Aug 09, 2009
Posts: 74
I still can't run the Selenium Test suite.
The error that I keep getting is described in the following Log thread:
2009-12-10 09:12:08,898 DEBUG com.actimize.selenium.infra.RCMSeleniumTestCase - about to start the browser
2009-12-10 09:42:39,336 ERROR com.actimize.selenium.infra.RCMSeleniumTestCase - failed to start selenium
java.lang.RuntimeException: Could not start Selenium session: Failed to start new browser session: Error while launching browser
at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:89)
at com.actimize.selenium.infra.Browser.start(Browser.java:39)
at com.actimize.selenium.infra.RCMSeleniumTestCase.runOnce(RCMSeleniumTestCase.java:40)
at com.actimize.selenium.infra.RCMSeleniumTestCase.setUp(RCMSeleniumTestCase.java:84)
at junit.framework.TestCase.runBare(TestCase.java:125)
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:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:289)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:656)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:558)
Caused by: com.thoughtworks.selenium.SeleniumException: Failed to start new browser session: Error while launching browser
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)
... 13 more

The tests are running from a Windows scheduled tasks.
If I call the schduled task to start manually - the tests are running and it is able to open the Explorer browser.
But if it run from the scheduler (and I am not login to this server on the same time) - I get the following error.

So it looks like a Windows problem more than a problem of the Selenium library. However I use the knowledge of this forum memebers to ask you:
do you know how I can set the windows-scheduled-task to be able to open the browser thorugh a Java process.
I don't think it has a permission (security) problem - the task is configured with the action "Read & Exceute" checked for all the users.
Douglas Ferguson
Greenhorn

Joined: Sep 07, 2009
Posts: 2
Did you ever get this running? We are seeing the same issues
Dave McQueen
Greenhorn

Joined: May 22, 2009
Posts: 29
I too am getting the same sort of error when running Selenium. Did anyone find a solution to this? I'm running on Ubuntu 11 so this is probably why the problem is occurring. However I'm not sure what the systemroot is, how you set it, why you set, what you set it to or where. Basically if someone could offer some help here you'd be shining a light on a very dark place!

Dave


Before you criticize someone, try walking a mile in their shoes. That way you'll be a mile away from them. And you'll also have their shoes.
sam backet
Greenhorn

Joined: Sep 02, 2011
Posts: 22

I have the same problem and use Ubuntu..can you help me..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Selenium - SystemRoot apparently not set
 
Similar Threads
POST method parameters
Where do I update the PATH environment?
Selenium - problem in starting the browser
[eclipse + win98]: Does not open
Selenium: Failed to start new browser...