I’m can’t type texts into the textfield of an UIAlertController.
WebElement field = (new WebDriverWait(driver, 5).until(ExpectedConditions.presenceOfElementLocated(By.xpath("//XCUIElementTypeTextField"))));
field.click();
// [1] This used to work in previous Appium versions, not it doesn't
//field.sendKeys("TEST");
// [2] Doesn't work either
typeTextIntoAlert("TEST");
public void typeTextIntoAlert(String test){
char[] charArray = test.toCharArray();
for(int i = 0; i < charArray.length; i++){
driver.findElement(By.xpath(String.format("//XCUIElementTypeKey[@name='%s']", Character.toString(charArray[i]).toLowerCase()))).click();
}
}
I’m using Appium 1.6.1 installed via terminal.
Error logs on eclipse:
"An element could not be located on the page using the given search parameters. (WARNING: The server did not provide any stacktrace information)"
Error log via command line:
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, accessibility id
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8100/session/ADBD4FF9-8340-4A67-B986-0265A9D5A28C/element] with body: {"using":"xpath","value":"//XCUIElementTypeKey[@name='t']"}
[debug] [JSONWP Proxy] Got response with status 200: {"value":"Alert is obstructing view","sessionId":"ADBD4FF9-8340-4A67-B986-0265A9D5A28C","status":26}
This worked in earlier versions. I had to update my Appium version because of long press action but doing so, this has been broken.