For some time I am trying to get more out of Selenium. Lot has changed here: selenium2 is a big improvement, and since 2.15 google also contributed its Advanced User Interactions API to the selenium code base, which seems to be a big improvement for mouse handling.
To get a better understanding of what is happening, and especially why my test scripts are failing, I wanted to control the logging of my webdriver. I noticed that this was a bit of a pain. Selenium firefox driver is using java.util.logging. So you are bound to the mechanisms that java.util.logging offers you for log configuration.
This is the approach I ended up with.
http://www.slf4j.org/legacy.html#jul-to-slf4j
To get a better understanding of what is happening, and especially why my test scripts are failing, I wanted to control the logging of my webdriver. I noticed that this was a bit of a pain. Selenium firefox driver is using java.util.logging. So you are bound to the mechanisms that java.util.logging offers you for log configuration.
This is the approach I ended up with.
- Before I startup my Firefox Webdriver, I used the setLogLevel method to set the Level of logging that is used for all driver logs. When you set this to WARNING, all logs that the driver makes, are considered to be WARNING logs, when you set them to FINE, all logs are considered to be FINE logs. So dependent on the settings inside your logging.properties, you will see these logs appear in your system out or not. I put the level to INFO, and now they are always appearing in my system.out output. During test development I do not mind. I will switch if off though when I move scripts to an automatic build environment.
- To change the settings for java.util.logging, you can either configure the file under java_home/jre/lib, or set the config file explicitly over the command line with -Djava.util.logging.config.file=myfile.
http://www.slf4j.org/legacy.html#jul-to-slf4j
Comments