@Test public void shouldHandleExceptionWhenElementHasStaleReference() { when(mockElement.isEnabled()).thenThrow(new StaleElementReferenceException("stale")); EnabledCondition condition = new EnabledCondition(); assertThat(condition.apply(mockElement), equalTo(false)); }
@Override public boolean apply(final WebElement element) { try { return element.isEnabled(); } catch (NullPointerException | WebDriverException e) { return false; } }
EnabledCondition extends Condition<WebElement> { @Override public boolean apply(final WebElement element) { try { return element.isEnabled(); } catch (NullPointerException | WebDriverException e) { return false; } } }
EnabledCondition extends Condition<WebElement> { @Override public boolean apply(final WebElement element) { try { return element.isEnabled(); } catch (NullPointerException | WebDriverException e) { return false; } }  }
EnabledCondition extends Condition<WebElement> { @Override public boolean apply(final WebElement element) { try { return element.isEnabled(); } catch (NullPointerException | WebDriverException e) { return false; } }  @Override boolean apply(final WebElement element); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString(); }
EnabledCondition extends Condition<WebElement> { @Override public boolean apply(final WebElement element) { try { return element.isEnabled(); } catch (NullPointerException | WebDriverException e) { return false; } }  @Override boolean apply(final WebElement element); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString();  }