Selenium WebDriver问题--Internet Explorer保护模式设置问题

在用WebDriver中打开Internet Explorer访问百度的是,报下面错误:

复制代码
org.openqa.selenium.remote.SessionNotFoundException: Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones. Enable Protected Mode must be set to the same value (enabled or disabled) for all zones. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 9.00 seconds
Build info: version: '2.37.0', revision: 'a7c61cb', time: '2013-10-18 17:15:02'
System info: host: 'zxy-PC', ip: '10.45.28.133', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.6.0_41'
Driver info: driver.version: InternetExplorerDriver
org.openqa.selenium.remote.SessionNotFoundException: Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones. Enable Protected Mode must be set to the same value (enabled or disabled) for all zones. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 9.00 seconds
Build info: version: '2.37.0', revision: 'a7c61cb', time: '2013-10-18 17:15:02'
System info: host: 'zxy-PC', ip: '10.45.28.133', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.6.0_41'
Driver info: driver.version: InternetExplorerDriver
Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones. Enable Protected Mode must be set to the same value (enabled or disabled) for all zones. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 9.00 seconds
{Driver info=driver.version: InternetExplorerDriver}
[sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method), sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source), sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source), java.lang.reflect.Constructor.newInstance(Unknown Source), org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:193), org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:151), org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554), org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:216), org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:201), org.openqa.selenium.ie.InternetExplorerDriver.run(InternetExplorerDriver.java:224), org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:214), org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:180), com.ztesoft.res.test.IE.LogInPageFireIE.startTest(LogInPageFireIE.java:48), sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method), sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source), sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source), java.lang.reflect.Method.invoke(Unknown Source), org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47), org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12), org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44), org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17), org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26), org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27), org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271), org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70), org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50), org.junit.runners.ParentRunner$3.run(ParentRunner.java:238), org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63), org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236), org.junit.runners.ParentRunner.access$000(ParentRunner.java:53), org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229), org.junit.runners.ParentRunner.run(ParentRunner.java:309), org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50), org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38), org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467), org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683), org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390), org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)]
复制代码

 

解决办法:

IE安全保护都去掉: 
internet选项——安全
internet-启用保护模式 勾去掉 
本地internet-启用保护模式 勾去掉 
可信站点-启用保护模式 勾去掉

posted on 2015-04-23 10:32  帅胡  阅读(2246)  评论(0编辑  收藏  举报

导航