@Test public void shouldHandleNull() { when(mockElement.getAttribute("innerHTML")).thenReturn(null); InnerHtmlContainsCondition condition = new InnerHtmlContainsCondition("blah"); assertThat(condition.apply(mockElement), equalTo(false)); }
@Override public boolean apply(final WebElement element) { try { return ignoreCase ? StringUtils.containsIgnoreCase(element.getAttribute("innerHTML"), text) : element.getAttribute("innerHTML").contains(text); } catch (NullPointerException | WebDriverException e) { return false; } }
InnerHtmlContainsCondition extends Condition<WebElement> { @Override public boolean apply(final WebElement element) { try { return ignoreCase ? StringUtils.containsIgnoreCase(element.getAttribute("innerHTML"), text) : element.getAttribute("innerHTML").contains(text); } catch (NullPointerException | WebDriverException e) { return false; } } }
InnerHtmlContainsCondition extends Condition<WebElement> { @Override public boolean apply(final WebElement element) { try { return ignoreCase ? StringUtils.containsIgnoreCase(element.getAttribute("innerHTML"), text) : element.getAttribute("innerHTML").contains(text); } catch (NullPointerException | WebDriverException e) { return false; } } InnerHtmlContainsCondition(final String text);  InnerHtmlContainsCondition(final boolean ignoreCase, final String text); }
InnerHtmlContainsCondition extends Condition<WebElement> { @Override public boolean apply(final WebElement element) { try { return ignoreCase ? StringUtils.containsIgnoreCase(element.getAttribute("innerHTML"), text) : element.getAttribute("innerHTML").contains(text); } catch (NullPointerException | WebDriverException e) { return false; } } InnerHtmlContainsCondition(final String text);  InnerHtmlContainsCondition(final boolean ignoreCase, final String text); @Override boolean apply(final WebElement element); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString(); }
InnerHtmlContainsCondition extends Condition<WebElement> { @Override public boolean apply(final WebElement element) { try { return ignoreCase ? StringUtils.containsIgnoreCase(element.getAttribute("innerHTML"), text) : element.getAttribute("innerHTML").contains(text); } catch (NullPointerException | WebDriverException e) { return false; } } InnerHtmlContainsCondition(final String text);  InnerHtmlContainsCondition(final boolean ignoreCase, final String text); @Override boolean apply(final WebElement element); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString();  }