Search code examples
javaseleniumselenium-webdriverjython-2.5geckodriver

Not working using Firefox geckodriver if you use a separate profile, it gives an error: java.lang.OutOfMemoryError: Java heap space


use:

selenium server 3.0.1
firefox 46+, tried on different versions
Windows 10
Jython 2.5.4

code:

self.profileDir = File(self.dict['profileDir'])
System.setProperty("webdriver.gecko.driver", Config.DISTR_DIR + '\\geckodriver.exe')
self.profile = FirefoxProfile(self.profileDir)
self.driver = FirefoxDriver(self.profile)

When I run an error occurs:

1479121081847   geckodriver INFO    Listening on 127.0.0.1:13582

self.driver = FirefoxDriver(self.profile)
java.lang.OutOfMemoryError: Java heap space

If you remove the download of the profile, and specify:

self.driver = FirefoxDriver()

all looks good so far, but I need to have a profile to load.
I tried to increase the memory of Java (now-Xms64M -Xmx512M) to-Xmx1200M (above why java complains), sometimes the browser starts, but this is extremely rare and unstable.
What are solutions and why this is happening because of the load profile?


Solution

  • The fact that the Firefox profile that I wanted to load, caching 350 MB of data and when I try to load java apparently all of this information swallowed and down the exit part of the hip. Clearing cache in the browser the problem does not reappear!!!