类org.openqa.selenium.ElementNotInteractableException源码实例Demo

下面列出了怎么用org.openqa.selenium.ElementNotInteractableException的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: htmlunit   文件: DomElementTest.java
/**
 * @throws Exception on test failure
 */
@Test(expected = ElementNotInteractableException.class)
public void clickHiddenSubmit() throws Exception {
    final String html = "<!DOCTYPE html>\n"
        + "<html><head></head>\n"
        + "<body>\n"
        + "  <form id='myForm' action='" + URL_SECOND + "'>\n"
        + "    <input id='myButton' type='submit' style='display: none;'>Submit</input>\n"
        + "  </form>\n"
        + "</body></html>";
    final String secondContent = "second content";

    getMockWebConnection().setResponse(URL_SECOND, secondContent);

    final WebDriver driver = loadPage2(html);
    driver.findElement(By.id("myButton")).click();
}
 
源代码2 项目: demo-java   文件: SynchExplicitTest.java
@Test
public void synchronizeExplicit() {
    driver.get("http://watir.com/examples/wait.html");
    WebDriverWait wait = new WebDriverWait(driver, 30);

    wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("add_foobar")));
    driver.findElement(By.id("add_foobar")).click();

    WebElement element = wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("foobar")));

    try {
        element.click();
        session.stop(true);
    } catch (ElementNotInteractableException e) {
        session.stop(false);
        Assert.assertTrue(e.getMessage(), false);
    }
}
 
源代码3 项目: ats-framework   文件: RealHtmlElement.java
/**
 * Simulate mouse click action
 */
@Override
@PublicAtsApi
public void click() {

    new RealHtmlElementState(this).waitToBecomeExisting();

    try {
        WebElement element = RealHtmlElementLocator.findElement(this);
        try {
            element.click();
        } catch (ElementNotInteractableException enie) {
            if (!UiEngineConfigurator.getInstance().isWorkWithInvisibleElements()) {
                throw enie;
            }
            ((JavascriptExecutor) webDriver).executeScript("arguments[0].click()", element);
        }
    } catch (Exception e) {
        throw new SeleniumOperationException(this, "click", e);
    }
}
 
源代码4 项目: htmlunit   文件: DomElementTest.java
/**
 * @throws Exception on test failure
 */
@Test(expected = ElementNotInteractableException.class)
public void clickInvisible() throws Exception {
    final String html = "<html>\n"
            + "<body>\n"
            + "  <a id='link' style='display: none'>Click me</a>\n"
            + "</body></html>";

    final WebDriver driver = loadPage2(html);
    driver.findElement(By.id("link")).click();
}
 
源代码5 项目: demo-java   文件: SynchSalsaVerdeTest.java
@Test
public void synchronizeSalsaVerde() {
    browser.goTo("http://watir.com/examples/wait.html");

    browser.element(By.id("add_foobar")).click();

    try {
        browser.element(By.id("foobar")).click();
        session.stop(true);
    } catch (ElementNotInteractableException e) {
        session.stop(false);
        Assert.assertTrue(e.getMessage(), false);
    }
}
 
源代码6 项目: demo-java   文件: SynchAbstractTest.java
@Test
public void synchronizeAbstract() {
    driver.get("http://watir.com/examples/wait.html");

    click(By.id("add_foobar"));

    try {
        click(By.id("foobar"));
        session.stop(true);
    } catch (ElementNotInteractableException e) {
        session.stop(false);
        Assert.assertTrue(e.getMessage(), false);
    }
}
 
源代码7 项目: keycloak   文件: KcPassword.java
public void clickEyeButton() {
    if (isEyeButtonDisabled()) {
        throw new ElementNotInteractableException("The eye button is disabled and cannot be clicked");
    }
    eyeButton.click();
}
 
 类所在包
 类方法
 同包方法