@Test public void shouldNotMatchConditionWhenReadyStateDoesNotEqualValue() { ReadyState readyState = ReadyState.COMPLETE; doReturn(false).when((JavascriptExecutor) mockDriver).executeScript("return (document.readyState == arguments[0]);", readyState.getLoadingStatus()); DocumentReadyStateCondition condition = new DocumentReadyStateCondition(readyState); assertThat(condition.apply(mockDriver), equalTo(false)); }
@Override public boolean apply(WebDriver webDriver) { try { final JavascriptExecutor js = (JavascriptExecutor) webDriver; return (Boolean) js.executeScript("return (document.readyState == arguments[0]);", readyState.getLoadingStatus()); } catch (WebDriverException e) { return false; } }
DocumentReadyStateCondition extends Condition<WebDriver> { @Override public boolean apply(WebDriver webDriver) { try { final JavascriptExecutor js = (JavascriptExecutor) webDriver; return (Boolean) js.executeScript("return (document.readyState == arguments[0]);", readyState.getLoadingStatus()); } catch (WebDriverException e) { return false; } } }
DocumentReadyStateCondition extends Condition<WebDriver> { @Override public boolean apply(WebDriver webDriver) { try { final JavascriptExecutor js = (JavascriptExecutor) webDriver; return (Boolean) js.executeScript("return (document.readyState == arguments[0]);", readyState.getLoadingStatus()); } catch (WebDriverException e) { return false; } } DocumentReadyStateCondition(final ReadyState readyState); }
DocumentReadyStateCondition extends Condition<WebDriver> { @Override public boolean apply(WebDriver webDriver) { try { final JavascriptExecutor js = (JavascriptExecutor) webDriver; return (Boolean) js.executeScript("return (document.readyState == arguments[0]);", readyState.getLoadingStatus()); } catch (WebDriverException e) { return false; } } DocumentReadyStateCondition(final ReadyState readyState); @Override boolean apply(WebDriver webDriver); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString(); }
DocumentReadyStateCondition extends Condition<WebDriver> { @Override public boolean apply(WebDriver webDriver) { try { final JavascriptExecutor js = (JavascriptExecutor) webDriver; return (Boolean) js.executeScript("return (document.readyState == arguments[0]);", readyState.getLoadingStatus()); } catch (WebDriverException e) { return false; } } DocumentReadyStateCondition(final ReadyState readyState); @Override boolean apply(WebDriver webDriver); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString();  }