2012-04-16 49 views
2

什么是Webdriver相当于assertconfirmation? 我具有以下其中当出口JUnit 4中(的webdriver)硒IDE代码返回一个错误:什么是webdriver等价于assertconfirmation?

IDE代码:

@Test 
    public void testUntitled2() throws Exception { 
     driver.findElement(By.linkText("Logout")).click(); 
     // ERROR: Caught exception [ERROR: Unsupported command [getConfirmation]] 
    } 

I:

,其对应于上述 ​​

导出的webdriver代码使用能够成功地使用以下与RC但使用webdriver它不再工作 - (请注意我试图将我的脚本迁移到webdriver)

assertTrue(selenium.getConfirmation().matches("^Are you sure you want to logout[\\s\\S]$")); 

干杯

回答

4

这应该是它!

final String text = "Are you sure you want to logout?"; 
assertTrue(driver.switchTo().alert().getText().equals(text)); 

...或者也许是 '匹配()' 版本,你到了那里。

switchTo()

alert()

getText()

+1

这已经完美工作 - 谢谢 – user929258 2012-04-17 08:26:29

相关问题