Search in sources :

Example 1 with ElementClickInterceptedException

use of org.openqa.selenium.ElementClickInterceptedException in project selenium_cdp by sergueik.

the class ExceptionListenerDevToolsTest method test4.

// see also: https://qna.habr.com/q/1089060
@Test
public void test4() {
    element = driver.findElement(By.cssSelector("#js-link-box-en"));
    String blinkTitlescrpit = "var titleState = 0; setInterval(() => { " + " document.title = titleState ? \"blinking\" : \"title\"; titleState = " + " titleState ? 0 : 1; } , 500 );";
    addOnClick(element, blinkTitlescrpit + "return false;");
    try {
        element.click();
    } catch (ElementClickInterceptedException e) {
        System.err.println("Exception(ignored) " + e.toString());
    }
    Utils.sleep(3000);
}
Also used : ElementClickInterceptedException(org.openqa.selenium.ElementClickInterceptedException) StringContains.containsString(org.hamcrest.core.StringContains.containsString) Test(org.junit.Test)

Example 2 with ElementClickInterceptedException

use of org.openqa.selenium.ElementClickInterceptedException in project selenium_cdp by sergueik.

the class ExceptionListenerDevToolsTest method test3.

// NOTE: the var titleState is intentionally not declared
// to trigger
// java.util.ConcurrentModificationException
// is the @After method printing exceptions
// presumably because new exceptions are thrown
// when setInterval is handler is called
@Test
public void test3() {
    element = driver.findElement(By.cssSelector("#js-link-box-en"));
    String blinkTitlescrpit = "setInterval(() => { " + " document.title = titleState? \"blinking\" : \"title\"; titleState = " + " titleState ? 0 : 1 ; } , 500 );";
    addOnClick(element, blinkTitlescrpit + "return false;");
    try {
        element.click();
    } catch (ElementClickInterceptedException e) {
        System.err.println("Exception(ignored) " + e.toString());
    }
    Utils.sleep(3000);
}
Also used : ElementClickInterceptedException(org.openqa.selenium.ElementClickInterceptedException) StringContains.containsString(org.hamcrest.core.StringContains.containsString) Test(org.junit.Test)

Example 3 with ElementClickInterceptedException

use of org.openqa.selenium.ElementClickInterceptedException in project zeppelin by apache.

the class AbstractZeppelinIT method clickAndWait.

protected void clickAndWait(final By locator) {
    WebElement element = pollingWait(locator, MAX_IMPLICIT_WAIT);
    try {
        element.click();
        ZeppelinITUtils.sleep(1000, false);
    } catch (ElementClickInterceptedException e) {
        // if the previous click did not happened mean the element is behind another clickable element
        Actions action = new Actions(driver);
        action.moveToElement(element).click().build().perform();
        ZeppelinITUtils.sleep(1500, false);
    }
}
Also used : Actions(org.openqa.selenium.interactions.Actions) ElementClickInterceptedException(org.openqa.selenium.ElementClickInterceptedException) WebElement(org.openqa.selenium.WebElement)

Example 4 with ElementClickInterceptedException

use of org.openqa.selenium.ElementClickInterceptedException in project selenium_java by sergueik.

the class ChromeSettingsTest method test3.

@Test
public void test3() {
    Assume.assumeTrue(browserChecker.testingChrome());
    urlLocator = "#basicPage > settings-section[page-title=\"Default browser\"]";
    shadowLocator = "settings-default-browser-page";
    shadow2Locator = "div#canBeDefaultBrowser";
    driver.navigate().to(baseUrl);
    element = shadowDriver.findElement(urlLocator);
    System.err.println(String.format("outerHTML: %s", element.getAttribute("outerHTML")));
    try {
        /*
			 * 
			 * actions.moveToElement(element).build().perform(); sleep(1000);
			 * actions.click().build().perform(); sleep(1000);
			 */
        element.click();
        sleep(1000);
    } catch (ElementClickInterceptedException e) {
        System.err.println("Exception (ignored): " + e.getMessage());
    // element click intercepted: Element is not clickable at point
    }
    // anything! - does not work either
    try {
        WebElement element2 = shadowDriver.findElement(element, shadowLocator);
        assertThat(element2, notNullValue());
        WebElement element3 = shadowDriver.findElement(element2, shadow2Locator);
        assertThat(element3, notNullValue());
    } catch (ElementNotVisibleException e) {
        System.err.println("Exception (ignored): " + e.getMessage());
    // Element with CSS settings-default-browser-page is not present on screen
    }
}
Also used : ElementClickInterceptedException(org.openqa.selenium.ElementClickInterceptedException) WebElement(org.openqa.selenium.WebElement) ElementNotVisibleException(org.openqa.selenium.ElementNotVisibleException) Test(org.junit.Test)

Example 5 with ElementClickInterceptedException

use of org.openqa.selenium.ElementClickInterceptedException in project primefaces by primefaces.

the class ConfirmDialog001Test method assertDialog.

private void assertDialog(Page page, boolean visible) {
    ConfirmDialog dialog = page.dialog;
    Assertions.assertEquals(visible, dialog.isVisible());
    if (visible) {
        try {
            // modal dialog should block clickability of button
            page.confirm.click();
            Assertions.fail("Button should not be clickable because modal mask is covering it!");
        } catch (ElementClickInterceptedException ex) {
        // element should be blocked by modal mask!
        } catch (WebDriverException ex) {
        // Safari: element should be blocked by modal mask!
        }
    } else {
        assertClickable(page.confirm);
        assertClickable(page.delete);
    }
    assertConfiguration(dialog.getWidgetConfiguration());
}
Also used : ElementClickInterceptedException(org.openqa.selenium.ElementClickInterceptedException) ConfirmDialog(org.primefaces.selenium.component.ConfirmDialog) WebDriverException(org.openqa.selenium.WebDriverException)

Aggregations

ElementClickInterceptedException (org.openqa.selenium.ElementClickInterceptedException)7 Test (org.junit.Test)3 StringContains.containsString (org.hamcrest.core.StringContains.containsString)2 WebDriverException (org.openqa.selenium.WebDriverException)2 WebElement (org.openqa.selenium.WebElement)2 ConfirmDialog (org.primefaces.selenium.component.ConfirmDialog)2 WebSessionEndedException (com.seleniumtests.customexception.WebSessionEndedException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 ElementNotVisibleException (org.openqa.selenium.ElementNotVisibleException)1 InvalidElementStateException (org.openqa.selenium.InvalidElementStateException)1 NoSuchSessionException (org.openqa.selenium.NoSuchSessionException)1 NoSuchWindowException (org.openqa.selenium.NoSuchWindowException)1 UnsupportedCommandException (org.openqa.selenium.UnsupportedCommandException)1 WebDriver (org.openqa.selenium.WebDriver)1 Actions (org.openqa.selenium.interactions.Actions)1 MoveTargetOutOfBoundsException (org.openqa.selenium.interactions.MoveTargetOutOfBoundsException)1