运行环境:
64位 Win7 professional IE8, 浏览器默认设置
Selenium脚本中通过 setUp(url, "iexplore")的方式设置浏览器
以java -jar selenium-server.jar不带参数的方式启动selenium server,程序在多窗口的模式下运行.
启动任意一个selenium的测试,出现如下
然后脚本就停住,不能继续运行,试过好多台win7的机器,都是这个情况,但是在Win Xp的IE8下面运行良好。
解决方案如下,这个是我给客户发的Email,文中提到的URL可能不能访问:
There are two main reasons that we need to install other Browser to run the Selenium tests.
1. The most important reason is the Selenium can’t run the tests in Win7 IE8 when the IE is set to “Protected Mode”, currently, the IE setting in build server is in this mode.
So, I can’t start to run the selenium tests in build server now.
You can refer to this URL:
• http://stackoverflow.com/questions/1517623/internet-explorer-8-64bit-and-selenium-not-working
2. The selenium execution will be very slow when running in IE, if I run all the tests by Google chrome, it will take less than 3 hours, but more than 5 hours in IE 8 even after I optimized the scripts
You can refer to:
• http://old.nabble.com/Selenium-slow-in-IE-compared-to-firefox.-td12087754.html
• http://groups.google.com/group/selenium-developers/browse_thread/thread/160a92fcacb12a62
3. For functional testing, the selenium test results of execution would be same if we run it in different browsers
So, if we want to run the selenium tests in Builder server, there are two workarounds
1. First one is to set the IE to “Protected off mode” by setting: Internet Options->Security->" Internet " icon->Enable Protected Mode
uncheck this option for all login user to let selenium tests run in "Protected Off" mode.
2. Install the Google Chrome or Firefox 3.0 to run the tests, Firefox3.6 is not supported directly.
总结:只要设置正确,IE下依然还是能运行的,唯一的区别就是运行速度,目前看来用Google Chrome去跑自动化测试最高效
PS:万一有语法错误,不要见笑,谢谢~