相同的代码在firefox中运行,但它没有在IE9中执行并显示字符串消息“这是WebDriver服务器的初始启动页面”.而其他人没有发现任何错误 public void setUp() throws Exception { File file = new File("C:/U
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号港口
更新:当您无权访问更改设置时,将ignoreZoomSetting和ignoreProtectedModeSettings功能设置为true会有所帮助.
如果您使用的是qaf,则可以设置如下功能:
driver.name=iexplorerDriver iexplorer.additional.capabilities={'ignoreProtectedModeSettings':true,'ignoreZoomSetting':true,'nativeEvents':false,'acceptSslCerts':true}