Skip to content

Commit

Permalink
optimize clear field step (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
JasperJhons authored and Yaromudr committed Aug 23, 2017
1 parent 038ab34 commit 83767fd
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
import io.appium.java_client.MobileElement;
import org.jbehave.core.annotations.Named;
import org.jbehave.core.annotations.When;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Keyboard;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import ru.colibri.ui.core.steps.AbsSteps;
Expand Down Expand Up @@ -47,9 +45,6 @@ public void sendText(@Named("$textOrKeyword") String textOrKeyword) {
@When("очистить \"$fieldName\"")
public void clearField(@Named("$fieldName") String fieldName) {
WebElement webElement = getWebElementByName(fieldName);
Keyboard keyboard = driver.getKeyboard();
for (int i = webElement.getText().length(); i > 0; i--) {
keyboard.sendKeys(Keys.BACK_SPACE);
}
webElement.clear();
}
}

0 comments on commit 83767fd

Please sign in to comment.