Note that there are some explanatory texts on larger screens.

plurals
  1. POSelenium server will not run remotely - issues launching firefox
    text
    copied!<p>I am struggling as I try to determine why my Selenium test scripts are now failing on my build server, since they were working up until last week. The script below works fine locally, but errors when run from Jenkins. I am running Selenium Server (v.selenium-server-standalone-2.21.0.jar), and am trying to execute a simple login script.</p> <p>I've already verified that there are no open Firefox sessions, and I've gone so far as to remove all profiles to ensure no contention.</p> <p>Here is the error output:</p> <pre><code>[junit] 08:38:27.016 INFO - Command request: getNewBrowserSession[*firefox, http://gamma:31640/aferewrite/login/, ] on session null [junit] 08:38:27.016 INFO - creating new remote session [junit] 08:38:27.032 INFO - Allocated session b61c10f039764b0fa49ef3c85b9d0648 for http://gamma:31640/aferewrite/login/, launching... [junit] 08:38:27.110 INFO - Preparing Firefox profile... [junit] 08:38:48.173 ERROR - Failed to start new browser session, shutdown browser and clear all session data [junit] java.lang.RuntimeException: Firefox refused shutdown while preparing a profile [junit] at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.waitForFullProfileToBeCreated(FirefoxChromeLauncher.java:367) [junit] at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.populateCustomProfileDirectory(FirefoxChromeLauncher.java:120) [junit] at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.launch(FirefoxChromeLauncher.java:90) [junit] at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.launchRemoteSession(FirefoxChromeLauncher.java:412) [junit] at org.openqa.selenium.server.browserlaunchers.FirefoxLauncher.launchRemoteSession(FirefoxLauncher.java:114) [junit] at org.openqa.selenium.server.BrowserSessionFactory.createNewRemoteSession(BrowserSessionFactory.java:381) [junit] at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(BrowserSessionFactory.java:125) [junit] at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(BrowserSessionFactory.java:86) [junit] at org.openqa.selenium.server.SeleniumDriverResourceHandler.getNewBrowserSession(SeleniumDriverResourceHandler.java:811) [junit] at org.openqa.selenium.server.SeleniumDriverResourceHandler.doCommand(SeleniumDriverResourceHandler.java:437) [junit] at org.openqa.selenium.server.SeleniumDriverResourceHandler.handleCommandRequest(SeleniumDriverResourceHandler.java:407) [junit] at org.openqa.selenium.server.SeleniumDriverResourceHandler.handle(SeleniumDriverResourceHandler.java:151) [junit] at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1530) [junit] at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1482) [junit] at org.openqa.jetty.http.HttpServer.service(HttpServer.java:909) [junit] at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820) [junit] at org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:986) [junit] at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837) [junit] at org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.java:243) [junit] at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:357) [junit] at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:534) [junit] Caused by: org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher$FileLockRemainedException: Lock file still present! C:\WINDOWS\TEMP\customProfileDirb61c10f039764b0fa49ef3c85b9d0648\parent.lock [junit] at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.waitForFileLockToGoAway(FirefoxChromeLauncher.java:318) [junit] at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.waitForFullProfileToBeCreated(FirefoxChromeLauncher.java:365) [junit] ... 20 more [junit] 08:38:48.188 INFO - Got result: Failed to start new browser session: Error while launching browser on session null [junit] 08:38:48.188 INFO - Stopping Acceptor ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=4444] [junit] 08:38:48.298 INFO - Stopped SocketListener on 0.0.0.0:4444 [junit] 08:38:48.344 INFO - Stopped HttpContext[/selenium-server/driver,/selenium-server/driver] [junit] 08:38:48.376 INFO - Stopped HttpContext[/selenium-server,/selenium-server] [junit] 08:38:48.407 INFO - Stopped HttpContext[/,/] [junit] 08:38:48.407 INFO - Stopped org.openqa.jetty.jetty.servlet.ServletHandler@1cfb802 [junit] 08:38:48.454 INFO - Stopped HttpContext[/wd,/wd] [junit] 08:38:48.454 INFO - Stopped org.openqa.jetty.jetty.Server@da2cef [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 21.907 sec [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 21.907 sec [junit] [junit] ------------- Standard Output --------------- [junit] 08:38:26.829 INFO - Java: Sun Microsystems Inc. 19.1-b02 [junit] 08:38:26.829 INFO - OS: Windows 2003 5.2 x86 [junit] 08:38:26.829 INFO - v2.21.0, with Core v2.21.0. Built from revision 16552 [junit] 08:38:26.938 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub [junit] 08:38:26.938 INFO - Version Jetty/5.1.x [junit] 08:38:26.938 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver] [junit] 08:38:26.938 INFO - Started HttpContext[/selenium-server,/selenium-server] [junit] 08:38:26.938 INFO - Started HttpContext[/,/] [junit] 08:38:26.969 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@1cfb802 [junit] 08:38:26.969 INFO - Started HttpContext[/wd,/wd] [junit] 08:38:26.969 INFO - Started SocketListener on 0.0.0.0:4444 [junit] 08:38:26.969 INFO - Started org.openqa.jetty.jetty.Server@da2cef [junit] 08:38:27.016 INFO - Checking Resource aliases [junit] 08:38:27.016 INFO - Command request: getNewBrowserSession[*firefox, http://gamma:31640/aferewrite/login/, ] on session null [junit] 08:38:27.016 INFO - creating new remote session [junit] 08:38:27.032 INFO - Allocated session b61c10f039764b0fa49ef3c85b9d0648 for http://gamma:31640/aferewrite/login/, launching... [junit] 08:38:27.110 INFO - Preparing Firefox profile... [junit] 08:38:48.188 INFO - Got result: Failed to start new browser session: Error while launching browser on session null [junit] 08:38:48.188 INFO - Stopping Acceptor ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=4444] [junit] 08:38:48.298 INFO - Stopped SocketListener on 0.0.0.0:4444 [junit] 08:38:48.344 INFO - Stopped HttpContext[/selenium-server/driver,/selenium-server/driver] [junit] 08:38:48.376 INFO - Stopped HttpContext[/selenium-server,/selenium-server] [junit] 08:38:48.407 INFO - Stopped HttpContext[/,/] [junit] 08:38:48.407 INFO - Stopped org.openqa.jetty.jetty.servlet.ServletHandler@1cfb802 [junit] 08:38:48.454 INFO - Stopped HttpContext[/wd,/wd] [junit] 08:38:48.454 INFO - Stopped org.openqa.jetty.jetty.Server@da2cef [junit] ------------- ---------------- --------------- </code></pre> <p>Here are the test scripts:</p> <pre><code>package com.mapfre.afetest.util; import java.util.Arrays; import java.util.Collection; import java.util.Vector; import java.util.logging.Logger; import java.util.logging.SimpleFormatter; import java.util.logging.StreamHandler; import com.thoughtworks.selenium.*; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; import org.openqa.selenium.server.SeleniumServer; /* * Execute Selenium test case using Excel data */ public class AfeSimpleLoginLogout extends SeleneseTestBase { private static SeleniumServer seleniumServer; public static Vector paramData = new Vector(); public static Vector testMethod = new Vector(); TestData td = new TestData("C:\\tools\\jexcelapi\\afe_testdata.xls"); @Before public void setUp() throws Exception { td.getDatafromXL(); paramData = td.getParamData(); testMethod = td.getTestMethods(); selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://gamma:31640/aferewrite/login/"); seleniumServer = new SeleniumServer(); seleniumServer.start(); selenium.start(); } @Test public void testAfeSimpleLogin() throws Exception { // set up new logger with output directed to standard out Logger logger = Logger.getLogger("my.test.logger"); StreamHandler sh = new StreamHandler(System.out, new SimpleFormatter()); logger.addHandler(sh); logger.info("-- Starting login process"); String workspace; workspace = System.getProperty("workspace"); logger.info("-- is there a value for workspace? val: " + workspace); // turn off parent handlers logger.setUseParentHandlers(false); // login based on Excel values and wait for main page selenium.open(paramData.get(0).toString()); selenium.type("j_username", paramData.get(1).toString()); selenium.type("j_password", paramData.get(2).toString()); logger.info("-- Clicking the submit button and waiting"); selenium.click("css=button.submitBtn"); selenium.waitForPageToLoad("300000"); logger.info("-- Looking for 'Policy changes should be requested' string on screen"); assertTrue(selenium.isTextPresent("Policy changes should be requested through one of the following contact points")); logger.info("-- Now logout"); selenium.click("link=Logout"); // FLUSH THE STREAM HANDLER !!! sh.flush(); } @After public void tearDown() throws Exception { selenium.stop(); seleniumServer.stop(); } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload