我正在使用Selenium InternetExplorerDriver来执行一些基本操作。在这种情况下,我要做的就是启动IE并导航到网页。到目前为止,我能够启动IE,但我看到的只是:“这是WebDriver服务器的初始启动页面。”
我花了很多时间试图研究这个问题,并尝试了一些事情,但都没有效果。我尝试过的很多事情中有两件是:
此时,我陷入困境,不知道如何继续使用IE浏览器。
我的代码:
public void setUp() throws IOException {
InputStream inputStream = getClass().getClassLoader().getResourceAsStream(propFileName);
prop.load(inputStream);
/** Set path for Log4j */
String pathtolog4j = prop.getProperty("PathToLog4j");
PropertyConfigurator.configure(pathtolog4j);
/** Bring up IEDriver & load application */
String pathtoIEdriver = prop.getProperty("PathToIEDriver");
File file = new File(pathtoIEdriver);
System.setProperty("webdriver.ie.driver", file.getAbsolutePath());
driver = new InternetExplorerDriver();
logger.info("Get URL");
String url = prop.getProperty("appURL");
driver.navigate().to(url);
}
堆栈跟踪:
Started InternetExplorerDriver server (64-bit) 2.35.3.0
Listening on port 4297
org.openqa.selenium.remote.SessionNotFoundException: Unexpected error launching Internet Explorer. Could not get document from window handle (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 2.80 seconds
Build info: version: '2.33.0', revision: '4ecaf82108b2a6cc6f006aae81961236eba93358', time: '2013-05-22 12:00:17'
System info: 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:191)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:151)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:216)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:201)
at org.openqa.selenium.ie.InternetExplorerDriver.run(InternetExplorerDriver.java:184)
at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:174)
at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:147)
at TestScripts.Drivers.InternetExplorer.IEDriverSetup.setUp(IEDriverSetup.java:64)