Example usage for org.openqa.selenium WebDriverException getMessage

List of usage examples for org.openqa.selenium WebDriverException getMessage

Introduction

In this page you can find the example usage for org.openqa.selenium WebDriverException getMessage.

Prototype

@Override
    public String getMessage() 

Source Link

Usage

From source file:org.cerberus.engine.execution.impl.ConditionService.java

License:Open Source License

/**
 * @author memiks//from w ww .j  a  v a  2  s .  c  o  m
 * @param exception the exception need to be parsed by Cerberus
 * @return A new Event Message with selenium related description
 */
private MessageEvent parseWebDriverException(WebDriverException exception) {
    MessageEvent mes;
    LOG.fatal(exception.toString());
    mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_FAILED_SELENIUM_CONNECTIVITY);
    mes.setDescription(mes.getDescription().replace("%ERROR%", exception.getMessage().split("\n")[0]));
    return mes;
}

From source file:org.cerberus.engine.gwt.impl.ControlService.java

License:Open Source License

/**
 * @author memiks//from  w  w w  . j a  va 2s  . co m
 * @param exception the exception need to be parsed by Cerberus
 * @return A new Event Message with selenium related description
 */
private MessageEvent parseWebDriverException(WebDriverException exception) {
    MessageEvent mes;
    LOG.fatal(exception.toString());
    mes = new MessageEvent(MessageEventEnum.CONTROL_FAILED_SELENIUM_CONNECTIVITY);
    mes.setDescription(mes.getDescription().replace("%ERROR%", exception.getMessage().split("\n")[0]));
    return mes;
}

From source file:org.cerberus.service.appium.impl.AppiumService.java

License:Open Source License

/**
 * @author vertigo17//from  www .  j a  va2s.c o  m
 * @param exception the exception need to be parsed by Cerberus
 * @return A new Event Message with selenium related description
 */
private MessageEvent parseWebDriverException(WebDriverException exception) {
    MessageEvent mes;
    LOG.fatal(exception.toString());
    mes = new MessageEvent(MessageEventEnum.ACTION_FAILED_SELENIUM_CONNECTIVITY);
    mes.setDescription(mes.getDescription().replace("%ERROR%", exception.getMessage().split("\n")[0]));
    return mes;
}

From source file:org.cerberus.service.engine.impl.ControlService.java

License:Open Source License

/**
 * @author memiks//from  www . j  a  v  a2s  .com
 * @param exception the exception need to be parsed by Cerberus
 * @return A new Event Message with selenium related description
 */
private MessageEvent parseWebDriverException(WebDriverException exception) {
    MessageEvent mes;
    LOG.fatal(exception.toString());
    mes = new MessageEvent(MessageEventEnum.CONTROL_FAILED_SELENIUM_CONNECTIVITY);
    mes.setDescription(mes.getDescription().replaceAll("%ERROR%", exception.getMessage().split("\n")[0]));
    return mes;
}

From source file:org.jboss.arquillian.graphene.ftest.page.extension.JQuerySelectorsPageExtensionTestCase.java

License:Open Source License

@Test
public void testFindByWrongSelector() {
    try {/*from w w  w.  ja va 2 s  .  co  m*/
        browser.findElement(ByJQuery.selector(":notExistingSelector"));
    } catch (WebDriverException ex) {
        // desired state
        assertTrue("The exception thrown after locating element by non existing selector is wrong!",
                ex.getMessage().contains(EXPECTED_WRONG_SELECTOR_MSG));
        return;
    }

    fail("There should be webdriver exception thrown when locating element by wrong selector!");
}

From source file:org.kie.wb.selenium.util.ObstructedClickExceptionHandler.java

License:Apache License

public static void retryClickUntilNotObstructed(WebElement element) {
    int triesRemaining = 100;
    boolean firstTime = true;
    while (triesRemaining > 0) {
        try {/*  w  w w. j  a v  a 2 s .  c  o m*/
            element.click();
            return;
        } catch (WebDriverException e) {
            if (isClickObstructedByPopupPanelGlass(e) || isClickObstructedByAlert(e)) {
                triesRemaining--;
                if (firstTime) {
                    firstTime = false;
                    String firstLineOfExceptionMessage = e.getMessage().split("\n")[0];
                    LOG.warn("Clicking element {} failed: {}", element, firstLineOfExceptionMessage);
                } else {
                    LOG.debug("Retrying click, {} tries remaining.", triesRemaining);
                }
                Waits.pause(100);
            } else {
                throw e;
            }
        }
    }
}

From source file:org.kie.wb.selenium.util.ObstructedClickExceptionHandler.java

License:Apache License

private static boolean isClickObstructedByPopupPanelGlass(WebDriverException e) {
    return e.getMessage().contains("gwt-PopupPanelGlass");
}

From source file:org.kie.wb.selenium.util.ObstructedClickExceptionHandler.java

License:Apache License

private static boolean isClickObstructedByAlert(WebDriverException e) {
    return e.getMessage().contains("alert-dismissable");
}

From source file:org.kurento.test.browser.WebRtcTestPage.java

License:Apache License

public void addTestName(String testName) {
    try {/* ww w.j  a v  a  2  s . c  om*/
        browser.executeScript("addTestName('" + testName + "');");
    } catch (WebDriverException we) {
        log.warn(we.getMessage());
    }
}

From source file:org.kurento.test.browser.WebRtcTestPage.java

License:Apache License

public void appendStringToTitle(String webRtcMode) {
    try {/* www  .j  av  a2s. co  m*/
        browser.executeScript("appendStringToTitle('" + webRtcMode + "');");
    } catch (WebDriverException we) {
        log.warn(we.getMessage());
    }
}