I am using Appium 1.4.13, java-client-3.3.0.jar, selenium standalone server 2.48.2 with IntelliJ.
I want to enter a value to UIATextField, which is a numberpicker. I read a tutorial and it suggested:
(MobileElement) iosDriver.findElement(By.xpath("//UIATextField")).sendKeys("abcdef");
but this didn't work: it just opened a native numberpicker from iOS
Another suggestion is to use setValue for java client 2.2.0:
(MobileElement) iosDriver.findElement(By.xpath("//UIATextField")).setValue("abcdef");
But setValue method is not there anymore.
So I have a workaround like below and it works:
(MobileElement) iosDriver.findElement(By.xpath("//UIATextField")).click;
iosDriver.scrollToExact("abcdef");
//click confirm
My questions:
Thanks
This is what I got from Appium Inspector when I run
(MobileElement) iosDriver.findElement(By.xpath("//UIATextField")).sendKeys("170");
setValue changed to be only valid for IOSElement. Cast your element accordingly and it should work.
Ex: (IOSElement) iosDriver.findElement(By.xpath("//UIATextField")).setValue("abcdef");