package org.coderinfo.demo;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
public class StartBrowser {
public static void main(String[] args) {
/* 如何使用IE浏览器
* 如果没有将IEDriverServer放入系统的环境变量中,那么必须在程序中设置 例如:
* System.setProperty("webdriver.ie.driver",* "IEDriverServer.exe文件存放的路径"* );
*/
System.setProperty("webdriver.ie.driver","C:\\Program Files\\Internet Explorer\\IEDriverServer.exe");
WebDriver driver = new InternetExplorerDriver();
driver.get("http://192.168.4.20/yocalyAdmin/login.jsp");
}
}
Started InternetExplorerDriver server (32-bit)
2.45.0.0
Listening on port 19529
Exception in thread "main" 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: 1.20 seconds
Build info: version: ‘2.45.0‘, revision: ‘5017cb8‘, time: ‘2015-02-27 00:00:10‘
System info: host: ‘WangHuan-PC‘, ip: ‘172.168.230.108‘, os.name: ‘Windows 7‘, os.arch: ‘x86‘, os.version: ‘6.1‘, java.version: ‘1.6.0_43‘
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:162)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:225)
at org.openqa.selenium.ie.InternetExplorerDriver.run(InternetExplorerDriver.java:182)
at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:174)
at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:146)
at org.coderinfo.demo.StartBrowser.main(StartBrowser.java:13)