Using Selenium to test on multiple versions of browsers
I was wondering if anyone is familiar with testing different browser versions using seleni开发者_运维百科um. I know that you can specify which browser to test (using *firefox or *iexplore) but what if I had multiple versions of firefox or IE installed and I wanted a test to launch a specific web browser version, such that one test would run IE7 and another might run against IE8.
Currently, my tests will always run against whatever default browser version I have installed. I realize if I had selenium running on multiple machines each one of those boxes could have a different browser version and that would solve my problem but I'd like to know if what I'm asking (multiple browser versions on one machine) is possible.
Thanks.
Actually you cannot have so much different versions of browsers on one machine - you cannot have different IE versions at the same time. IETester is an option, but is not as good as having virtual machines with different versions of IE and FF.
Anyway the best approach to this is to use different machines - either real or virtual
You can pass an additional argument that is the full path to the browser binary. But, most browsers are picky about having multiple versions installed, many don't even allow it. In that case, you really need separate machines running each environment that you need. Selenium Grid is an excellent option here. We use it to test in IE6, IE7, IE8, FF, & Chrome right now. Each test specifies what environment it wants and that gets mapped back to a launcher on a particular machine.
Yes its possible to run tests on trageted browser :
I have FF3.6 and FF4.1 installed on my tests since there is no good support for Selenium IDE in FF4.1, I want to run test against FF3.6.17 . Here what I do :
. Add an environment variable DEFAULT_BROWSER as
"*custom path/to/firefox 3.6/firefox.exe"
. $TESTS_SELENIUM_BROWSER= getenv('DEFAULT_BROWSER') ? ...
in php code
. write test class as
class myTests extends PHPUnit_Extensions_SeleniumTestCase{
....
protected function setUp()
{
$this->setBrowser($TESTS_SELENIUM_BROWSER);
....
}
}
hope this will help :)
精彩评论