Created
January 30, 2020 00:57
-
-
Save brobles82/f893df75dd378a5c60aef64958f73ae2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void type(String text, WebElement webElement) { | |
if (text == null) { | |
return; | |
} | |
new WebDriverWait(driver(), 30).until((WebDriver) -> { | |
try { | |
webElement.clear(); | |
if (webElement.getAttribute("value").length() > 0) { | |
for(int i=0; i<webElement.getAttribute("value").length; i++) { | |
webElement.sendKeys(Keys.BACK_SPACE); | |
} | |
} | |
webElement.sendKeys(text); | |
return webElement.getAttribute("value").equals(text); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment