Getting "Java heap space" error with Selenium 3.0.1

1,466 views
Skip to first unread message

Pragnya Sahoo

unread,
Dec 27, 2016, 2:31:21 AM12/27/16
to Selenium Users

Hi All,

I'm using Selenium 3.0.1 with Firefox version 50 on Win 7.
So, when I'm running the below lines of code

System.setProperty("webdriver.gecko.driver", "D:\\Selenium\\geckodriver-v0.11.1-win64\\geckodriver.exe");
ProfilesIni profile = new ProfilesIni();
FirefoxProfile fp = profile.getProfile("Selenium");
DesiredCapabilities dc = DesiredCapabilities.firefox();
dc.setCapability(FirefoxDriver.PROFILE, fp);
WebDriver driver = new FirefoxDriver(dc);
driver.get("http://www.google.com");



getting the below error:

[GFX1-]: CreateShaderResourceView failed for format87
Exception in thread "main" 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.StringWriter.write(Unknown Source)
    at com.google.gson.stream.JsonWriter.string(JsonWriter.java:559)
    at com.google.gson.stream.JsonWriter.writeDeferredName(JsonWriter.java:402)
    at com.google.gson.stream.JsonWriter.value(JsonWriter.java:495)
    at com.google.gson.internal.bind.TypeAdapters$25.write(TypeAdapters.java:686)
    at com.google.gson.internal.bind.TypeAdapters$25.write(TypeAdapters.java:704)
    at com.google.gson.internal.bind.TypeAdapters$25.write(TypeAdapters.java:642)
    at com.google.gson.internal.Streams.write(Streams.java:68)
    at com.google.gson.JsonElement.toString(JsonElement.java:324)
    at java.lang.String.valueOf(Unknown Source)
    at org.openqa.selenium.remote.JsonToBeanConverter.convert(JsonToBeanConverter.java:92)
    at org.openqa.selenium.remote.JsonToBeanConverter.convertMap(JsonToBeanConverter.java:343)
    at org.openqa.selenium.remote.JsonToBeanConverter.convert(JsonToBeanConverter.java:217)
    at org.openqa.selenium.remote.JsonToBeanConverter.convert(JsonToBeanConverter.java:46)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:113)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:64)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:241)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:128)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:259)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:247)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:242)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:135)
    at TestPage.main(TestPage.java:18)



NOTE: But when I had previously ran the test with Selenium 2.53.1 (when gecko driver was not there) along with same firefox profile as stated above in the code, it was running fine.

Please help me in solving this issue.


Thanks in Advance
Pragnya Sahoo

⇜Krishnan Mahadevan⇝

unread,
Dec 27, 2016, 2:51:59 AM12/27/16
to Selenium Users
Your code is failing because your profile size is very huge. If you look at the stacktrace you would notice that the failure begins from createSession() which is where your profile gets serialized and the failure seems to arise from there.

Please check your profile size and get rid of things that you perhaps may not be needing.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/9bfaf8dc-bdc1-4744-ab7a-9d039ec8e0af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Pragnya Sahoo

unread,
Dec 27, 2016, 3:17:12 AM12/27/16
to Selenium Users
Thanks Krishnan for the reply... It worked after I removed some files.

But just want to know, is there any new changes as part Selenium 3.0.1 related to FirefoxProfile because as I had mentioned earlier I was able to run with same profile with Selenium 2.53.1 without deleting any files ?


Thanks & Regards
Pragnya Sahoo
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.

⇜Krishnan Mahadevan⇝

unread,
Dec 27, 2016, 3:34:44 AM12/27/16
to Selenium Users
I am not sure if there were any changes related to serialising profile data (I doubt if there were any). You may have to sift through GitHub commit history or look at the change history of the relevant classes (FirefoxDriver and FirefoxProfile) to figure out if there were any.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/b8bf16ec-6600-4a28-9ba4-8ef5195a80cf%40googlegroups.com.

sushil bajaj

unread,
Jun 1, 2017, 3:14:40 AM6/1/17
to Selenium Users
Hi Pragnya,

i am getting the same heap size error. can you please tell me which files u removed which helped you...

kindly share the information soon.

Thanks & Regards
Sushil Bajaj

Krishnan Mahadevan

unread,
Jun 1, 2017, 3:17:08 AM6/1/17
to seleniu...@googlegroups.com

What are you doing to trigger the heap space error ? Can you please help call that out ?

 

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

 

Reply all
Reply to author
Forward
0 new messages