WebDriverBackedSelenium:确认处理抛出:UnsupportedOperationException

时间:2011-08-30 15:41:17

标签: java selenium alert webdriver confirmation

我使用WebDriverBackedSelenium在我的测试中处理确认对话和警报

    WebDriver driver = new FirefoxDriver();
    driver.get("https://uat03.testnet.com/uat03/main.asp");

    Selenium selenium = new WebDriverBackedSelenium(driver,"https://uat03.testnet.com/uat03/main.asp");

    WebElement logout = driver.findElement(By.linkText("Logoff"));                 
    logout.click();

    selenium.chooseOkOnNextConfirmation();
    selenium.getConfirmation();

    WebDriver driverInstance = ((WebDriverBackedSelenium) selenium).getUnderlyingWebDriver();

当测试达到:chooseOkOnNextConfirmation();控制台抛出错误:

Exception in thread "main" java.lang.UnsupportedOperationException: getConfirmation
at org.openqa.selenium.WebDriverCommandProcessor.execute(WebDriverCommandProcessor.java:278)
at org.openqa.selenium.WebDriverCommandProcessor.getString(WebDriverCommandProcessor.java:252)
at com.thoughtworks.selenium.DefaultSelenium.getConfirmation(DefaultSelenium.java:429)
at testscripts.Deployment.main(Deployment.java:149)

我已经关注了“seleniumhq”网站上的文档,我不明白为什么会抛出这个错误,任何想法?

0 个答案:

没有答案