测试人社区

Appium-ios-picker-wheels-set-value

iOS pickerWheels: Fast ‘.setValue()’ example

Unfortunately, XCTest cannot always properly interact with picker wheel
controls. Sometimes the setValue() call might not have any effect.

How to make picker wheel controls more compatible to XCTest:

  • if PickerWheel view is simple e.g. any text: month name, date or
    country name in most cases ‘.setValue()’ works.
  • if PickerWheel value complicated e.g. country flag image and country
    text then the probability of failure increases.

One PickerWheel

String txt = "exact_text";
MobileElement el = (MobileElement) driver.findElement(MobileBy.className("XCUIElementTypePickerWheel"));
el.setValue(txt);

Multiple PickerWheels

String txt = "exact_text";
List<MobileElement> el = driver.findElements(MobileBy.className("XCUIElementTypePickerWheel"));

// set first PickerWheel
el.get(0).setValue(txt);

// set second PickerWheel
el.get(1).setValue(txt);

官方链接为:http://appium.io/docs/en/writing-running-appium/tutorial/swipe/ios-picker-wheels-set-value

IOS端的滚动获取指定日期如何做呢?安卓端的我们是通过判断显示日期那一行的高度进行滑动来递增/递减的,ios端的滑动目前只了解到scroll(),漫无目的,所以请教一下在IOS端怎样可以控制滑动到指定元素?