If you have proxy set at your machine with Selenium sometimes you need to setup proxy not only for browser but for binding too.
Python binding uses default urllib/urllib2 libraries which read machine configuration and uses it for connection.
At least at Windows it reads "<scheme>_proxy" enviroment variables for proxy
and "no_proxy" or "NO_PROXY" for bypass addresses. Also it could read Windows Registry for IE proxy settings which are system defaults.
So if your grid is behind proxy or python could not connect even to local driver (see https://code.google.com/p/selenium/issues/detail?id=6213 as example) you need to setup either IE proxy settings or OS enviroment variables like http_proxy, no_proxy etc.
ausavchuk
четверг, 5 сентября 2013 г.
пятница, 9 августа 2013 г.
IEDriverServer.exe debugging
IEDriverServer crashes sometimes. To debug it it's necessary to get crash report.
So i figure out how to enable collecting it. It's quite easy - just set up some keys in registry (for Windows 7 at least).
As Chef powershell resource it can be written as:
After that using MS Visual Studio and debug files as *.pdb which are generated during iedriver building (may require renaming IEDriver.dll to something as IED89D.tmp for proper symbols loading) you can investigate crash stacktrace, local variables etc.
So i figure out how to enable collecting it. It's quite easy - just set up some keys in registry (for Windows 7 at least).
As Chef powershell resource it can be written as:
powershell "enable crash reports for IEDriverServer" doIn result if IEDriverServer crashes a new file .dmp will be created.
code <<-EOH
if (Test-Path "HKLM:\\SOFTWARE\\Microsoft\\Windows\\Windows Error Reporting\\LocalDumps") {
} else {
New-Item "HKLM:\\SOFTWARE\\Microsoft\\Windows\\Windows Error Reporting\\LocalDumps"
}
if (Test-Path "HKLM:\\SOFTWARE\\Microsoft\\Windows\\Windows Error Reporting\\LocalDumps\\IEDriverServer.exe") {
} else {
New-Item "HKLM:\\SOFTWARE\\Microsoft\\Windows\\Windows Error Reporting\\LocalDumps\\IEDriverServer.exe"
}
Set-ItemProperty "HKLM:\\SOFTWARE\\Microsoft\\Windows\\Windows Error Reporting\\LocalDumps\\IEDriverServer.exe" -Name DumpCount -Value 10
Set-ItemProperty "HKLM:\\SOFTWARE\\Microsoft\\Windows\\Windows Error Reporting\\LocalDumps\\IEDriverServer.exe" -Name DumpType -Value 2
Set-ItemProperty "HKLM:\\SOFTWARE\\Microsoft\\Windows\\Windows Error Reporting\\LocalDumps\\IEDriverServer.exe" -Name DumpFolder -Value "C:\\iedriverserver_crash\\"
EOH
end
After that using MS Visual Studio and debug files as *.pdb which are generated during iedriver building (may require renaming IEDriver.dll to something as IED89D.tmp for proper symbols loading) you can investigate crash stacktrace, local variables etc.
воскресенье, 21 июля 2013 г.
How to use custom Firefox profile
By default FirefoxProfile (here and below it's about Java binding) allows to set preferences and extensions.
What if you need to setup another file from profile folder, e.g. cert8.db ?
Code below is for remote case. For local case code will be similar.
You could use something like:
---------------------------------------------------- File profileDir = new File("<path-do-folder-with-profile>") FirefoxProfile profile = new FirefoxProfile(profileDir); DesiredCapabilities dc = DesiredCapabilities.firefox(); dc.setCapability(FirefoxDriver.PROFILE, profile); webdriver = new RemoteWebDriver(capabilites); ----------------------------------------------------
or (if you have named Firefox profile) : ---------------------------------------------------- FirefoxProfile profile = new ProfilesIni().getProfile("<name-of-profile>"); DesiredCapabilities dc = DesiredCapabilities.firefox(); dc.setCapability(FirefoxDriver.PROFILE, profile); webdriver = new RemoteWebDriver(capabilites); ---------------------------------------------------- In both cases content of profile folder will be zipped and sent to grid, then to node, unzipped to tmp folder and used as profile of started firefox. It could consume too much resources. You al so could use another way: 1. do not pass any profile data in capabilities 2. run node as: java -Dwebdriver.firefox.profile=<name-of-profile> ... In this case a folder of named Firefox profile <name-of-profile> at node will be copied to tmp folder, updated and used as profile of started firefox.
среда, 17 июля 2013 г.
Firefox browser support by different selenium version
Very usefull information was collected by santiycr from SauceLabs - he investigated FF browser support by different Seleniums (Thank you! :) ).
Here is initial topic at Selenium Developers - https://groups.google.com/forum/?hl=ru#!topic/selenium-developers/jJeuJNmQg3o
Collected data are stored at github https://github.com/santiycr/selenium-firefox-support-matrix
It may help planningg during selenium updates.
Here is initial topic at Selenium Developers - https://groups.google.com/forum/?hl=ru#!topic/selenium-developers/jJeuJNmQg3o
Collected data are stored at github https://github.com/santiycr/selenium-firefox-support-matrix
It may help planningg during selenium updates.
четверг, 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.
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.
webdriver.chrome.logfile
Affect path to log file of chromedriver server.
webdriver.chrome.driver
Affect path to chromedriver binary.
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.
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:
Here is some results:
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.
понедельник, 20 мая 2013 г.
Screenshots for headless configuration
Just a few notes about screenshots for "headless" configuration: 1. if you use service-based configuration you _need_ to setup it to use local account. SYSTEM account doesn't have possibility to interact to desktop. Be sure that you local account can log in successfully. 2. if you use service-based configuration you _need_ to set "Allow service to interact with desktop" option enabled for the service. Otherwise service can not interact with desktop. 3. If you use RDP to run grid2 node please be sure that you session doesn't become locked. Use something like "tscon SessionID /dest:console" to close the Remote Desktop session and reconnects the session to the remote computer's console. 4. If you use RDP to run grid2 node please do not disconnect from the Remote Desktop Connection session, lock the computer or minimize the Remote Desktop window. In such case Windows switches the Remote Desktop session to the GUI-less mode and does not draw the GUI. It prevents to take screenshots. You could change this behaviour by setting: HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\RemoteDesktop_SuppressWhenMinimized = 2 HKEY_LOCAL_MACHINE\Software\Microsoft\Terminal Server Client\RemoteDesktop_SuppressWhenMinimized = 2 (another keys may be used on x64) and rebooting after. Another good solution is to use VNC instead of RDP. i hope it helps.
Подписаться на:
Сообщения (Atom)