четверг, 6 июня 2013 г.

Java system properties supported by Selenium


Long time ago i wanted to describe java system properties related to WebDriver.
Below is a list of such properties with short description of what they are designed for.

This list of in draft state and it's needed to be updated and extended (but all of these still can affect WebDriver behaviour):
1. some system properties as "line.separator", "os.version", "os.arch", "os.name", "java.version", "java.vm.version", "java.vm.name", "java.vm.vendor", "java.io.tmpdir" are just skipped;
2. source code of RC, java tests, future outdated Iphone simulator and jetty server is skipped too;
3. "https?.proxy*" properties are skipped;
4. env variables are out of review.

Misc

webdriver.reap_profile
Affect cleaning temporary files and folders. By default is to clean. Used in FF profile cleaning and at remote server session cleaning.

webdriver.remote.server
Affect default WebDriver remote URL used when null is passed in. Default is http://localhost:4444/wd/hub

webdriver.remote.quietExceptions
Affect instantiation of special thread which take screenshot at error and attach it to json result responce.

selenium.LOGGER
Affect path to default log file for selenium server.

Chrome

webdriver.chrome.logfile
Affect path to log file of chromedriver server.

webdriver.chrome.driver
Affect path to chromedriver binary.

Firefox

webdriver.development
Affect development mode. Used mostly in tests and at Firefox profile unpacking.

webdriver.firefox.profile
Affect name (not path!) of profile which will be used if no profile is passed in.
Profile data are looked for inside folder defined at profiles.ini for specified profile name.

webdriver.firefox.library.path
Affect path added as firefox library path into library path enviroment variable
which is used during fireefox binary instanciating.

webdriver.firefox.bin
Affects firefox binary used for firefox instanciating.

webdriver.firefox.logfile
Affect path to log file into which firefox process will write stdout during instanciating.

Internet Explorer

webdriver.ie.driver
Affect path to IEDriverServer binary.

webdriver.ie.driver.logfile
Affect path to log file to which IEDriverServer will log to

webdriver.ie.driver.loglevel
Affect logging level

webdriver.ie.driver.host
Affect host to which IEDriverServer  will bind

webdriver.ie.driver.extractpath
Affect folder to which IEDriverServer  will unpack necessary resources

webdriver.ie.driver.silent
Affect will IEDriverServer print some additional messages to console or not

webdriver.ie.driver.forcecreateprocess
Affect which API will be used by IEDriverServer during IE instanciating.

webdriver.ie.driver.ieswitches
Affect which CLI switches will be used during IE instanciating if webdriver.ie.driver.forcecreateprocess is set.

Safari

webdriver.safari.noinstall
Affect will be installed safari extension or not.

webdriver.safari.driver
Affect path to safarit extension which will be installed.

понедельник, 3 июня 2013 г.

Manual proxy support by Selenium

For work purposes i checked ability of Selenium to set up proxy for ie/ff/chrome/opera browsers in last days.

Main requirements are the following:

  • support of http and https proxying, 
  • parallel work at node level, 
  • direct specification of unique proxy host and port for each test (PAC/WPAD are excluded from checking due it is not supported by IE. that means that proxyType=manual is used).

Here is some results:

  • Opera - partially (HTTPS proxy is not set up: issue #5728 was created);
  • Firefox - all is ok (2 ways are supported - by proxy capability and using FF preferences);
  • Chrome - all is ok (2 ways are supported too - by proxy capability and using --proxy-server CLI switch);
  • IE - failed.
For IE old RC way to setup proxy is used - by Java WindowsProxymanager and hudsuckr utility a global proxy settings are set up at Windows registry. 
This leads to some conflicts at parallel setting of proxies by different processes, f.e.

Unable to start new session due WebDriverException() (Message: u'Cannot get output before executing command line: C:\\Windows\\system32\\reg.exe add HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\Styles /v MaxScriptStatements /t REG_DWORD /d 2147483647 /f' ; Stacktrace: Method getStdOut threw an error in UnixProcess.java ). 9 retries is available.
or
Unable to start new session due WebDriverException() (Message: u'exec return code 1: \u040b\u0438\u0401\u040e\u0404\xa0: \u040c\u0490 \u0433\xa4\xa0\u0490\u0432\u0431\u043f \xad\xa0\xa9\u0432\u0401 \u0433\u0404\xa0\xa7\xa0\xad\xad\u043b\xa9 \u0430\xa0\xa7\xa4\u0490\xab \u0401\xab\u0401 \u0407\xa0\u0430\xa0\xac\u0490\u0432\u0430 \u045e \u0430\u0490\u0490\u0431\u0432\u0430\u0490.\r\n' ; Stacktrace: Method <init> threw an error in WindowsRegistryException.java ). 9 retries is available.

Also last process which set up proxy defines it for all existed processes.

Another thing i found was after IEdriver quiting proxy settings are sometimes not restored - 
looks like created Java thread (which should do it) is not executed or failed at some point. 


As result we'll not use proxying at all. Problem will be solved by replacing SUT configuration and creating mocks at another level.

Hope this helps.