@Test public void shouldMatchConditionWhenElementPositionUnchanged() { when(((Locatable) mockElement).getCoordinates()).thenReturn(mockCoordinates); when(((Locatable) mockElement).getCoordinates().inViewPort()).thenReturn(new Point(100, 100), new Point(100, 100)); PositionUnchangedCondition condition = new PositionUnchangedCondition(100); assertThat(condition.apply(mockElement), equalTo(true)); }
@Override public boolean apply(final WebElement element) { try { Point location = ((Locatable) element).getCoordinates().inViewPort(); Thread.sleep(delayIntervalMillis); Point nextLocation = ((Locatable) element).getCoordinates().inViewPort(); return location.equals(nextLocation); } catch (NullPointerException | WebDriverException e) { return false; } catch (InterruptedException e) { Thread.currentThread().interrupt(); return false; } }
PositionUnchangedCondition extends Condition<WebElement> { @Override public boolean apply(final WebElement element) { try { Point location = ((Locatable) element).getCoordinates().inViewPort(); Thread.sleep(delayIntervalMillis); Point nextLocation = ((Locatable) element).getCoordinates().inViewPort(); return location.equals(nextLocation); } catch (NullPointerException | WebDriverException e) { return false; } catch (InterruptedException e) { Thread.currentThread().interrupt(); return false; } } }
PositionUnchangedCondition extends Condition<WebElement> { @Override public boolean apply(final WebElement element) { try { Point location = ((Locatable) element).getCoordinates().inViewPort(); Thread.sleep(delayIntervalMillis); Point nextLocation = ((Locatable) element).getCoordinates().inViewPort(); return location.equals(nextLocation); } catch (NullPointerException | WebDriverException e) { return false; } catch (InterruptedException e) { Thread.currentThread().interrupt(); return false; } } PositionUnchangedCondition(final long delayIntervalMillis); }
PositionUnchangedCondition extends Condition<WebElement> { @Override public boolean apply(final WebElement element) { try { Point location = ((Locatable) element).getCoordinates().inViewPort(); Thread.sleep(delayIntervalMillis); Point nextLocation = ((Locatable) element).getCoordinates().inViewPort(); return location.equals(nextLocation); } catch (NullPointerException | WebDriverException e) { return false; } catch (InterruptedException e) { Thread.currentThread().interrupt(); return false; } } PositionUnchangedCondition(final long delayIntervalMillis); @Override boolean apply(final WebElement element); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString(); }
PositionUnchangedCondition extends Condition<WebElement> { @Override public boolean apply(final WebElement element) { try { Point location = ((Locatable) element).getCoordinates().inViewPort(); Thread.sleep(delayIntervalMillis); Point nextLocation = ((Locatable) element).getCoordinates().inViewPort(); return location.equals(nextLocation); } catch (NullPointerException | WebDriverException e) { return false; } catch (InterruptedException e) { Thread.currentThread().interrupt(); return false; } } PositionUnchangedCondition(final long delayIntervalMillis); @Override boolean apply(final WebElement element); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString();  }