robotframework / OldSeleniumLibrary

Deprecated Selenium library for Robot Framework
Apache License 2.0
13 stars 3 forks source link

Ability to provide additional options to selenium java process #242

Closed spooning closed 9 years ago

spooning commented 9 years ago

Originally submitted to Google Code by chmielsster on 21 Jun 2012

Please add ability to provide custom options to java process which runs Selenium Server.

Proposed patch - it uses environment variable. I've used SELENIUM_JAVA_OPTS for environment variable name because JAVA_OPTS may be too generic.

Index: SeleniumLibrary/init.py

--- SeleniumLibrary/init.py (wersja 15373) +++ SeleniumLibrary/init.py (kopia robocza) @⁠@⁠ -82,7 +82,10 @⁠@⁠ if not jarpath: jarpath = SELENIUM_SERVER_PATH params = _add_default_user_extension(jarpath, list(params))

spooning commented 9 years ago

Originally submitted to Google Code by @yanne on 6 Aug 2012

Start Selenium Server already accepts *params, which can be used to pass arbitrary command line options to Selenium Server startup.

Is there a reason you cannot use that?

spooning commented 9 years ago

Originally submitted to Google Code by chmielsster on 6 Aug 2012

As I understant *params provides custom command line options to Selenium server and I need a custom options to java process which runs Selenium server: java <my options> -jar jarpath + _server_startup_params(params)

which can be seen at the bottom of my patch above. I needed this to route all traffic through proxy to log all HTTP requests and responses.

spooning commented 9 years ago

Originally submitted to Google Code by chmielsster on 6 Aug 2012

Correct patch: --- SeleniumLibrary/init.py (wersja 15373) +++ SeleniumLibrary/init.py (kopia robocza) @⁠@⁠ -82,7 +82,10 @⁠@⁠ if not jarpath: jarpath = SELENIUM_SERVER_PATH params = _add_default_user_extension(jarpath, list(params))

spooning commented 9 years ago

Originally submitted to Google Code by @yanne on 6 Aug 2012

You are correct, I read the patch too fast.

I still do not think that configuring some things via keyword arguments and others via environment variables is the best possible approach.

Unfortunately, it is also quite difficult to change the signature of start_selenium_server without backwards incompatibility issues. One option could be to accept some special name in *params, but that's quite obscure too.

I'll think about this a bit, but something will definitely be done.

spooning commented 9 years ago

Originally submitted to Google Code by @yanne on 27 Aug 2012

Going to fix this by adding special check in Start Selenium Server for argument named JVM.

So, after the fix, this will work:

Start Selenium Server JVM=-Dsomething --ensureCleanSession

which translates to

java -Dsomething selenium-server.jar -ensureCleanSession

spooning commented 9 years ago

Originally submitted to Google Code by @yanne on 27 Aug 2012

This issue was updated by revision 5dbeb11bdbd9.