下面的Webdriver脚本在FF17中工作正常,但在IE-7中出现错误。我已经更改了IE的保护模式仍无输出
公共类driver{
DefaultSelenium selenium;
private WebDriver driver;
private StringBuffer verificationErrors = new StringBuffer();
@Before
public void setUp() throws Exception {
driver = new InternetExplorerDriver();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
@Test
public void testTimeWebdriver(){
try {
WebElement userName, passWord, submit;
driver.manage().getCookies();
driver.get("http://www.google.co.in/");
//driver.manage().;
driver.findElement(By.id("gbqfq").sendKeys("hello"));
driver.findElement(By.id("gbqfba")).click();
WaitForPageToLoad wait = new WaitForPageToLoad();
wait.setTimeToWait(30000);
} catch (Exception e) {
System.out.println(e);
}
}
@After
public void tearDown() throws Exception {
driver.quit();
String verificationErrorString = verificationErrors.toString();
if (!"".equals(verificationErrorString)) {
fail(verificationErrorString);
}
}
Error for IE:Error:Unable to find element with name == userid(警告:服务器没有提供任何stacktrace信息);Duration或timeout: 30.07秒有关此错误的文档,请访问:http://seleniumhq.org/exceptions/no_such_element.html构建信息:版本:'2.8.0',修订:'14056',时间:'2011-10-06 12:41:26'系统信息:os.name: 'Windows XP';Arch: 'x86', os。版本:'5.1',java。版本:"1.6.0_38"驱动信息:Driver。版本:RemoteWebDriver
WebDriver不支持IE7
。你可以用IE8 or higher version
。