相同的代码在 firefox 中运行,但未在 IE9 中执行并显示字符串消息“这是 WebDriver 服务器的初始启动页面”。而其他人没有发现错误
public void setUp() throws Exception {
File file = new File("C:/Users/Sunil.Wali/Desktop/Softwares/IEDriverServer_Win32_2.37.0/IEDriverServer.exe");
System.setProperty("webdriver.ie.driver", file.getAbsolutePath());
driver = new InternetExplorerDriver();
// driver = new FirefoxDriver();
baseUrl = "https://tssstrpms501.corp.trelleborg.com:12001";
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
@Test
public void testLogin() throws Exception {
driver.get(baseUrl + "/ProcessPortal/login.jsp");
driver.findElement(By.id("username")).clear();
driver.findElement(By.id("username")).sendKeys("sunil.wali");
driver.findElement(By.id("password")).clear();
driver.findElement(By.id("password")).sendKeys("Trelleborg@123");
driver.findElement(By.id("log_in")).click();
driver.findElement(By.id("processPortalUserDropdown")).click();
driver.findElement(By.id("dijit_MenuItem_56_text")).click();
}
@After
public void tearDown() throws Exception {
driver.quit();
String verificationErrorString = verificationErrors.toString();
if (!"".equals(verificationErrorString)) {
fail(verificationErrorString);
}
}
输出:-
启动 InternetExplorerDriver 服务器(32 位)
2.37.0.0
监听 31651 端口
最佳答案
确保每个区域的保护模式设置值相同。引用 Required Configuration for IE .
更新 : 设置 ignoreZoomSetting
和 ignoreProtectedModeSettings
功能到 true
当您无权更改设置时会有所帮助。
如果您正在使用 qaf您可以设置如下功能:
driver.name=iexplorerDriver
iexplorer.additional.capabilities={'ignoreProtectedModeSettings':true,'ignoreZoomSetting':true,'nativeEvents':false,'acceptSslCerts':true}
关于selenium - 这是 WebDriver 服务器的初始启动页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19979283/