@Test public void shouldHandleExceptionWhenElementHasStaleReference() { when(mockElement.getCssValue("font-weight")).thenThrow(new StaleElementReferenceException("stale")); CssPropertyEqualsCondition condition = new CssPropertyEqualsCondition("font-weight", "700"); assertThat(condition.apply(mockElement), equalTo(false)); }
@Override public boolean apply(final WebElement element) { try { String cssValue = element.getCssValue(cssProperty); return cssValue != null && cssValue.equals(value); } catch (NullPointerException | WebDriverException e) { return false; } }
CssPropertyEqualsCondition extends Condition<WebElement> { @Override public boolean apply(final WebElement element) { try { String cssValue = element.getCssValue(cssProperty); return cssValue != null && cssValue.equals(value); } catch (NullPointerException | WebDriverException e) { return false; } } }
CssPropertyEqualsCondition extends Condition<WebElement> { @Override public boolean apply(final WebElement element) { try { String cssValue = element.getCssValue(cssProperty); return cssValue != null && cssValue.equals(value); } catch (NullPointerException | WebDriverException e) { return false; } } CssPropertyEqualsCondition(final String cssProperty, final String value); }
CssPropertyEqualsCondition extends Condition<WebElement> { @Override public boolean apply(final WebElement element) { try { String cssValue = element.getCssValue(cssProperty); return cssValue != null && cssValue.equals(value); } catch (NullPointerException | WebDriverException e) { return false; } } CssPropertyEqualsCondition(final String cssProperty, final String value); @Override boolean apply(final WebElement element); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString(); }
CssPropertyEqualsCondition extends Condition<WebElement> { @Override public boolean apply(final WebElement element) { try { String cssValue = element.getCssValue(cssProperty); return cssValue != null && cssValue.equals(value); } catch (NullPointerException | WebDriverException e) { return false; } } CssPropertyEqualsCondition(final String cssProperty, final String value); @Override boolean apply(final WebElement element); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString();  }