robotframework / OldSeleniumLibrary

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

Overriding selenium server port by environmental variable. #121

Closed spooning closed 9 years ago

spooning commented 9 years ago

Originally submitted to Google Code by Bartlom... on 2 Jun 2010

It would be great if there was a way to override selenium server port (that might have been set in test cases) by environmental variable (i.e. SELENIUM_SERV_PORT - for symmetry SELENIUM_SERV_NAME could be provided)

I am running multiple selenium servers on different ports for different users (linux) - I want to be able run testaces on them without any modification to test files.

spooning commented 9 years ago

Originally submitted to Google Code by @pekkaklarck on 2 Jun 2010

Robot Framework test data syntax allows you to use %[NAME} syntax to reference environment variables. That maes it possible to take the libray into use like this:

| Library | SeleniumLibrary | | | %{SELENIUM_SERV_PORT} |

With RF 2.5 also this works:

| Library | SeleniumLibrary | server_port=%{SELENIUM_SERV_PORT} |

Alternatively you could use normal variables (e.g. ${SELENIUM_SERV_PORT}) and pass them from the command line (e.g. --variable SELENIUM_SERV_PORT:1234).

I think these possibilities are enough. Do others think speical environment variables should be supported otherwise?

spooning commented 9 years ago

Originally submitted to Google Code by Bartlom... on 11 Jun 2010

Those features are nice, thanks, but they require modification of test files. The problem is that I am not writing them. My task is to set up test server that allow developers to start tests. Most of tests have already been written. I can not afford to trust that all tests will have port set up correctly.

spooning commented 9 years ago

Originally submitted to Google Code by @pekkaklarck on 11 Jun 2010

I still believe that there should be only one way to configure something like this. If we allow configuring server port and address using environment variables, should we also allow configuring timeout and other import time options? Should the environment variable have higher priority than the import time option or not?

To make it sure that the library is imported the same way every time, you could use a resource file and import the library there.

spooning commented 9 years ago

Originally submitted to Google Code by @yanne on 11 Nov 2010

We decided not to implement this, since there are other ways of achieving the desired outcome.