Java Code Examples for org.openqa.selenium.WebDriverException#printStackTrace()

The following examples show how to use org.openqa.selenium.WebDriverException#printStackTrace() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IEDriverFactory.java    From seleniumtestsframework with Apache License 2.0 6 votes vote down vote up
@Override
public void cleanUp() {
    try {
        if (driver != null) {
            try {
                driver.quit();
            } catch (WebDriverException ex) {
                ex.printStackTrace();
            }

            driver = null;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 2
Source File: WebUIDriver.java    From seleniumtestsframework with Apache License 2.0 6 votes vote down vote up
public static void cleanUp() {
    IWebDriverFactory iWebDriverFactory = getWebUIDriver().webDriverBuilder;
    if (iWebDriverFactory != null) {
        iWebDriverFactory.cleanUp();
    } else {
        WebDriver driver = driverSession.get();
        if (driver != null) {
            try {
                driver.quit();
            } catch (WebDriverException ex) {
                ex.printStackTrace();
            }

            driver = null;
        }
    }

    driverSession.remove();
    uxDriverSession.remove();
}
 
Example 3
Source File: SafariDriverFactory.java    From Learning-Spring-Boot-2.0-Second-Edition with MIT License 5 votes vote down vote up
@Override
public SafariDriver getObject() throws BeansException {
	if (properties.getSafari().isEnabled()) {
		try {
			return new SafariDriver();
		} catch (WebDriverException e) {
			e.printStackTrace();
			// swallow the exception
		}
	}
	return null;
}
 
Example 4
Source File: FirefoxDriverFactory.java    From Learning-Spring-Boot-2.0-Second-Edition with MIT License 5 votes vote down vote up
@Override
public FirefoxDriver getObject() throws BeansException {
	if (properties.getFirefox().isEnabled()) {
		try {
			return new FirefoxDriver();
		} catch (WebDriverException e) {
			e.printStackTrace();
			// swallow the exception
		}
	}
	return null;
}
 
Example 5
Source File: WebPage.java    From kurento-java with Apache License 2.0 5 votes vote down vote up
private void activatePeerConnectionStats(String jsFunction, String peerConnectionId) {

    try {
      browser.executeScript("kurentoTest." + jsFunction + "('" + peerConnectionId + "');");

    } catch (WebDriverException we) {
      we.printStackTrace();

      // If client is not ready to gather rtc statistics, we just log it
      // as warning (it is not an error itself)
      log.warn("Client does not support RTC statistics (function kurentoTest.{}() not defined)",
          jsFunction);
    }
  }
 
Example 6
Source File: WebPage.java    From kurento-java with Apache License 2.0 5 votes vote down vote up
private void stopPeerConnectionStats(String jsFunction, String peerConnectionId) {

    try {
      log.debug("kurentoTest." + jsFunction + "('" + peerConnectionId + "');");
      browser.executeScript("kurentoTest." + jsFunction + "('" + peerConnectionId + "');");

    } catch (WebDriverException we) {
      we.printStackTrace();

      // If client is not ready to gather rtc statistics, we just log it
      // as warning (it is not an error itself)
      log.warn("Client does not support RTC statistics (function kurentoTest.{}() not defined)");
    }
  }
 
Example 7
Source File: ExecutableTest.java    From selenium with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() {
  try {
    binaryPath = new FirefoxBinary().getPath();
  } catch (WebDriverException ex) {
    ex.printStackTrace();
    Assume.assumeTrue(false);
  }
}
 
Example 8
Source File: SeleniumValueEditor.java    From phoenix.webui.framework with Apache License 2.0 4 votes vote down vote up
/**
 * 填入值,如果目标元素有readonly,则不做任何操作
 * @param ele 目标元素
 * @param value 要填入的值,null会当作空字符串
 * @param append 是否追加
 */
private void fillValue(Element ele, Object value, boolean append)
{
	if(value == null)
	{
		value = "";
	}

	WebElement webEle = searchStrategyUtils.findStrategy(WebElement.class, ele).search(ele);
	if(webEle != null)
	{
		String readonlyAttr = webEle.getAttribute("readonly");
		if(StringUtil.isNotBlank(readonlyAttr))
		{
			logger.warn("{} is readonly, will do not call method setValue.", webEle.toString());
			return;
		}
		
		String valueStr = value.toString();
		try
		{
			fill(webEle, valueStr, append);
		}
		catch(WebDriverException e)
		{
			if(e.getMessage().contains("is not clickable at point"))
			{
				((JavascriptExecutor) engine.getDriver()).executeScript("arguments[0].scrollIntoView();", webEle);

				fill(webEle, valueStr, append);
			}
			else
			{
				e.printStackTrace();
			}
		}
	}
	else
	{
		logger.error(String.format("can not found element [%s].", ele));
	}
}