UIAPickerWheel.selectValue () does not work for text values ​​in UIDatePicker

I created a simple project using storyboards containing only UIDatePicker with mode = Date (so the dates look like "November" "28" "2011").

In UI Automation Tools, I'm trying to set the values ​​of individual date pickers.

I can successfully use the selectValue () method to set the wheels, which contains numerical values, but cannot set the text value of the month, for example. "November".

It works.

target.frontMostApp().mainWindow().pickers()[0].wheels()[1].selectValue(12);

but this is not so.

target.frontMostApp().mainWindow().pickers()[0].wheels()[0].selectValue("November");

I get an error: Script threw an uncaught JavaScript error: - selectValue is not supported on a picker with undefined values

I did UIATarget.localTarget().frontMostApp().logElementTree()and see that the value is correct:

UIAPickerWheel: value: November rect: {{1, 142}, {146, 216}}

Please, someone can advise what I can do wrong, thank you very much.

+5
5

xcode (4.5.2)

target.frontMostApp().mainWindow().pickers()[0].wheels()[0].selectValue("November");

+4
while(monthWheel.value() != "June"){
  monthWheel.tapWithOptions({tapOffset:{x:0.5, y:0.33}});
  target.delay(0.5);
}

, , value() , . tapWithOptions() .

+2

, , . 12 , .

while(target.frontMostApp().mainWindow().pickers()[0].wheels()[0].value != "November"){
  target.frontMostApp().mainWindow().pickers()[0].wheels()[0].tap();
}
0

,

var pickerWheel1Values  = picker.wheels()[1]. values();

,

picker.wheels()[index]. selectValue (pickerWheel1Values[10]);
0

, Appium, , : https://groups.google.com/d/msg/appium-discuss/uYdRTdQDvpU/2I7KSFHnqFwJ

:

  • get your selection item (tag name: collector)
  • get all wheels for this collector (tag name: pickerwheel)
  • you can list the values ​​for this wheel by running element.getAttribute ("values")
  • you can set the value by executing element.setValue (myNewValue)

The last step is wrong and you need to use sendKeys () instead of setValue ()

For a real example, for example, how I used this, there would be something like this

String pickerWheelLocation = "UIATarget.localTarget().frontMostApp().windows()[3].pickers()[0].elements()[0]"
By pickerWheelBy = MobileBy.IosUIAutomation(pickerWheelLocation)
IOSElement pickerWheel = WebDriverHelper.getDriver().findElement(pickerWheelBy);
pickerWheel.sendKeys("New Value");

IOSElement doneButton = WebDriverHelper.getDriver().findElement(MobileBy.IosUIAutomation("UIATarget.localTarget().frontMostApp().windows()[2].toolbars()[0].buttons()["Done"]"));
    doneButton.click();
0
source

All Articles