I got the developer certificate from Apple and running Selenium 2.23.1 jar. I checked out the base code from Selenium website and when I ran the command " go Safari", I am getting the following error and would like to know how to resolve this error

C:\Selenium>go safari
Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

Any help is greatly appreciated.

  • According to this answer: stackoverflow.com/questions/9303889/… it could be due to using the 32-bit vs 64-bit version.
    – Sam Woods
    Dec 6, 2012 at 16:59
  • 2
    Can you please mention what efforts you have made to resolve this issue and where else have you looked? This will help people help you. Copying your error message and pasting it on google gave me quite a few links, some of them pointing to stackoverflow: tinyurl.com/abesjlm Dec 6, 2012 at 17:02

2 Answers 2


You don't need to any more. As of 2.30.0 The Safari Driver extension is bundled inside the Selenium jar and automatically installed into Safari when you run tests against it.

It now just works :)

Added more information

To quote https://code.google.com/p/selenium/wiki/SafariDriver

Starting with Selenium 2.30.0, the SafariDriver comes bundled with the Selenium server. If you wish to build the driver from source, head over to the SafariDriverInternals page. For now, grab a copy of the Selenium jar and add it to your classpath. Writing a test for Safari is just as straightforward as using the FirefoxDriver:

  • I am still struggling to get Safari working with version 2.30.0 - do we definitely not need to create the extension for Safari, then?
    – DevDave
    Feb 26, 2013 at 16:12
  • 1
    Positive, I've added a link to the SafariDriver wiki entry and pulled out the relevant quote.
    – Ardesco
    Feb 27, 2013 at 9:31

To resolve the error, edit go.bat at the root of your selenium repository.

You will see the following line:

java -Xmx2048m -XX:MaxPermSize=1024m -XX:ReservedCodeCacheSize=256m -client -jar third_party\jruby\jruby-complete.jar -X-C -S rake %*

Decrease the value of the highlighted digits, by changing it to:

java -Xmx512m -XX:MaxPermSize=512m -XX:ReservedCodeCacheSize=256m -client -jar third_party\jruby\jruby-complete.jar -X-C -S rake %*

After this change, you should be able to run go and build Selenium. If the error still shows up, reduce the boldfaced numbers. The meaning of these flags are explained in this answer on Stack Overflow.

PS. If you want to set up an environment for developing Selenium in Windows, have a look at https://github.com/jimevans/windows-selenium-dev-setup.

  • Welcome to SQA, Rob! If I understand your post correctly, your premise is that if Selenium can't get the space it's asking for, we should try reducing how much it asks for?
    – corsiKa
    Jun 14, 2013 at 17:39
  • @corsiKa Yes. I've revised my answer to clarify that. Does it look better now?
    – Rob W
    Jun 14, 2013 at 17:40
  • I never thought it wasn't a great answer! I just wanted to make sure I understood what it was doing, that's all. :-)
    – corsiKa
    Jun 14, 2013 at 18:13
  • Thanks for the answer. Editing go.bat didn't help, but then I edited the go file (the same way), and it worked. Jul 16, 2013 at 7:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.