@Test public void shouldInvokeBackSpaceSendKeys() { String value = "hello123"; when(mockElement.getAttribute("value")).thenReturn(value); DeleteContentAction deleteContentAction = new DeleteContentAction(); deleteContentAction.perform(mockElement); verify(mockElement, times(value.length())).sendKeys(Keys.BACK_SPACE); }
@Override public void perform(final WebElement target) { final String value = target.getAttribute("value"); for (int character = 0; character < value.length(); character++) { try { target.sendKeys(Keys.BACK_SPACE); Thread.sleep(delayMillis); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } }
DeleteContentAction implements Action, Delayable { @Override public void perform(final WebElement target) { final String value = target.getAttribute("value"); for (int character = 0; character < value.length(); character++) { try { target.sendKeys(Keys.BACK_SPACE); Thread.sleep(delayMillis); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } } }
DeleteContentAction implements Action, Delayable { @Override public void perform(final WebElement target) { final String value = target.getAttribute("value"); for (int character = 0; character < value.length(); character++) { try { target.sendKeys(Keys.BACK_SPACE); Thread.sleep(delayMillis); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } }  }
DeleteContentAction implements Action, Delayable { @Override public void perform(final WebElement target) { final String value = target.getAttribute("value"); for (int character = 0; character < value.length(); character++) { try { target.sendKeys(Keys.BACK_SPACE); Thread.sleep(delayMillis); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } }  static DeleteContentAction deleteContentAction(); @Override void perform(final WebElement target); @Override synchronized Action withDelayMillis(final long delayMillis); }
DeleteContentAction implements Action, Delayable { @Override public void perform(final WebElement target) { final String value = target.getAttribute("value"); for (int character = 0; character < value.length(); character++) { try { target.sendKeys(Keys.BACK_SPACE); Thread.sleep(delayMillis); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } }  static DeleteContentAction deleteContentAction(); @Override void perform(final WebElement target); @Override synchronized Action withDelayMillis(final long delayMillis);  }