
现在Win7 已经应用很多了,即使是最原始的Win7 也是IE8,最新的patch后,都升到了IE11
Win7下预装高版本IE的情况下,启动IE WebDriver可能会出现:
org.openqa.selenium.WebDriverException: Unexpected error launching Internet Explorer. Protected Mode must be set to the same value (enabled or disabled) for all zones.
其原因是微软自IE7以后加入了Protected Mode的概念,为何如此请参考 为什么我们需要安全模式
在这种情况下,要继续启动IE WebDriver进行自动化测试,需要修改注册表,如下:
1、运行 regedit.exe
2、找到HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones
3、可以看到


如果1-4号Key下面都有名叫2500的属性,则将其值改为相同的非零值(这个地方我还没有在其他人的系统上尝试过,我自己的系统上默认的是1,2号key 2500属性值为3,3,4号key 2500属性为0,我将3,4号key的值置为了3,IE WebDriver成功启动)