title: Running selenium test automatically
body: <p>I have a problem with Selenium and can't get it to work.<br>
  What I want to do:<br>
  A customer of ours sends us a Selenium test case which shall be executed automatically in several locations and the time taken shall be recorded.
  We want to use Selenium and Firefox Portable, because we want to make the tests completely independent of any user input and the installed software at the different locations.
  So much for the starting conditions ;)<br>
  What we did so far:<br>
  The first version was completely written in Java, we exported the test case from the customer to Java with the Selenium IDE Plugin -> Export to Java WebDriver.
  This cannot be done anymore, because the customer now uses some functions the WebDriver export does not support. And as we don't want to alter the test from the customer, Java export is no longer an option.<br>
  So for the first run we are using this command (any variables are set correctly):</p>
  
  <pre><code>java -jar selenium-2.33.0/selenium-server-standalone-2.33.0.jar -port 5555 
  -firefoxProfileTemplate "Firefox\Data\profile" -log logs\selenium_server.log 
  -htmlSuite "*firefox" http://localhost:5555 Testsuite.html
  logs\results-firefox-%curTimestamp%.html
  </code></pre>
  
  <p>This starts my preinstalled firefox, not the portable one. On the customers machine, no firefox is started whatsoever, because it is not installed. So I had to provide the path to the firefox instead, using the "custom" htmlSuite:</p>
  
  <pre><code>java -jar selenium-2.33.0/selenium-server-standalone-2.33.0.jar -port 5555 
  -firefoxProfileTemplate "Firefox\Data\profile" -log logs\selenium_server.log 
  -htmlSuite "*custom %FF_DIR%\FirefoxPortable.exe" http://localhost:5555 Testsuite.html 
  logs\results-firefox-%curTimestamp%.html
  </code></pre>
  
  <p>This does not work, as the Selenium Server cannot execute this command if run under Windows, which we do (see: <a href="http://code.google.com/p/selenium/issues/detail?id=3274" rel="nofollow noreferrer">http://code.google.com/p/selenium/issues/detail?id=3274</a>)
  As comment #6 has some diffs, we patched the selenium Server standalone Jar and ran the test again. Now the browser could be started, but the test could not be run. After the first page loaded we get the error "Permission denied to access property 'document'".<br>
  A solution here suggests, a user-rights problem could be the cause and you should try the "chrome" htmlSuite (see: <a href="https://sqa.stackexchange.com/questions/1453/how-to-fix-permission-denied-to-access-property-document">https://sqa.stackexchange.com/questions/1453/how-to-fix-permission-denied-to-access-property-document</a>)
  So we did:</p>
  
  <pre><code>java -jar selenium-2.33.0/selenium-server-standalone-2.33.0-patched.jar 
  -port 5555 -firefoxProfileTemplate "FirefoxPortable\Data\profile" 
  -log logs\selenium_server.log -htmlSuite "*chrome %FF_DIR%\FirefoxPortable.exe" 
  http://localhost:5555 Testsuite.html logs\results-firefox-%curTimestamp%.html
  </code></pre>
  
  <p>Notice our "patched" selenium and the "chrome" htmlSuite.
  That didn't work, as well.
  So, here in short the results:</p>
  
  <ul>
  <li><p>htmlSuite = firefox: the preinstalled Firefox is used, if installed, not the Portable one. In case, no FF is installed, the test fails altogether</p></li>
  <li><p>htmlSuite = chrome: the server cannot start the browser, as it tries to set EnvironmentVariables, which is not supported running Windows (see: <a href="http://code.google.com/p/selenium/source/browse/java/client/src/org/openqa/selenium/os/WindowsProcessGroup.java#67" rel="nofollow noreferrer">http://code.google.com/p/selenium/source/browse/java/client/src/org/openqa/selenium/os/WindowsProcessGroup.java#67</a> lines 67 following)</p></li>
  <li><p>htmlSuite = googleChrome: Google Chrome Portable can be started, but the Chrome browser cannot find some elements specified by the test, so we cannot use Chrome (altering the test is no option, as stated above)</p></li>
  <li><p>htmlSuite = iexplore: Internet Explorer starts, but then a JavaScript error appears, referencing a custom Profile created by Selenium, so the test does not work in IE, either</p></li>
  <li><p>htmlSuite = custom: the Portable Firefox is started (yeehaw), but does not have sufficient rights to execute the test.</p></li>
  </ul>