New issue 2792 by felixjmo...@gmail.com: Java Heap Space Error when using
Remote Firefox Profile
http://code.google.com/p/selenium/issues/detail?id=2792
I have the following Code:
private static RemoteWebDriver getRemoteFirefox(String host) {
RemoteWebDriver remoteWebDriver = null;
DesiredCapabilities cap = DesiredCapabilities.firefox();
FirefoxProfile profile = (new ProfilesIni()).getProfile("default");
// HERE cap.setCapability(FirefoxDriver.PROFILE, profile);
try {
System.out.println("trying ff");
remoteWebDriver = new RemoteWebDriver(new URL("http://" + host
+ ":4444/wd/hub"), cap);
} catch (MalformedURLException e) {
e.printStackTrace();
}
return remoteWebDriver;
}
What steps will reproduce the problem?
1. one can execute the code with the HERE line commented
2. now run the code with the HERE line not as a comment
3. look at the output of the selennium-server-standalone
What is the expected output? What do you see instead?
Expected a Firefox window opening.
Instead I have an exception on the terminal (will add as a comment)
Selenium version:
OS: Junit 4 Test with Selenium 2.11 on Linux within Eclipse. Windows XP
with selenium-server-standalone 2.11 and Firefox 7.0.1 on the
RemoteWebDriver site.
The stack trace is here
10:31:14.832 INFO - Done: /session/1320658223646
10:39:02.063 WARN - Error for /wd/hub/session
java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Unknown Source)
at java.lang.AbstractStringBuilder.expandCapacity(Unknown Source)
at java.lang.AbstractStringBuilder.ensureCapacityInternal(Unknown
Source)
at java.lang.AbstractStringBuilder.append(Unknown Source)
at java.lang.StringBuffer.append(Unknown Source)
at java.io.BufferedReader.readLine(Unknown Source)
at java.io.BufferedReader.readLine(Unknown Source)
at
org.openqa.selenium.remote.server.rest.ResultConfig.setJsonParameters(ResultConfig.java:251)
at
org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConfig.java:179)
at
org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverServlet.java:555)
at
org.openqa.selenium.remote.server.DriverServlet.doPost(DriverServlet.java:492)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at
org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet.java:459)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at
org.openqa.jetty.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
at
org.openqa.jetty.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:677)
at
org.openqa.jetty.jetty.servlet.ServletHandler.handle(ServletHandler.java:568)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1530)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1482)
at org.openqa.jetty.http.HttpServer.service(HttpServer.java:909)
at
org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820)
at
org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:986)
at
org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837)
at
org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.java:243)
at
org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:357)
at
org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
Similar to issue 2393
Comment #3 on issue 2792 by simon.m.stewart: Java Heap Space Error when
using Remote Firefox Profile
http://code.google.com/p/selenium/issues/detail?id=2792
The error message is pretty clear: you need to allocate more heap space to
java (at least twice the size of the profile being transported is
recommended)
Sending the default profile is seldom a good idea: it contains all the
files that firefox has cached and is probably unnecessarily large. Better
is to prepare a skeleton profile that contains just the things you need and
transfer that across the wire.
I am still afraid there might be an issue. Setting -Xmx to 1024M die not
solve it for me. However, the profile is just 113 MB.
Using
firefoxProfile.addExtension(extension);
on a new profile solved it.