1

Right now, I am able to set accessibility labels and identifiers for different picker wheels in my application so that the recorder can pick up when I tap these picker wheels, and I am able to swipe up and down to modify the values, but I am unsure if there is a way for me to specify an exact value to select in these pickers. I am currently running XCode 7 Beta 5 and here is the following code I currently have:

//Expands the cell with the DatePicker
XCUIApplication().tables.staticTexts["Due Date"].tap() 

//Modifies the Month, Day, and Year picker wheels.
XCUIApplication().tables.cells["dueDate"].pickerWheels["August"].swipeUp()
XCUIApplication().tables.cells["dueDate"].pickerWheels["19"].swipeUp()
XCUIApplication().tables.cells["dueDate"].pickerWheels["2015"].swipeUp()

As I mentioned, this code works fine, but I kind of have to guess at what the end result would be based upon the current start date (which is the current date, in our app) instead of being able to set the date to a known value.

Has anybody else been running into this same issue? If so, are there any known work arounds? It seems like the set of gestures that the API can mimic are still fairly limited.

Senseful
  • 86,719
  • 67
  • 308
  • 465

1 Answers1

0

Per this post starting in Beta 6 you should be able to do something like this...

app.datePickers.pickerWheels["2015"].adjustToPickerWheelValue("2005")
concertman
  • 13
  • 5
  • Yes, it is [doable](http://stackoverflow.com/questions/31257409/how-to-select-a-picker-view-item-in-an-ios-ui-test-in-xcode) but the question is actually about setting specific dates so your answer does not really work. – Stanislav Pankevich Sep 29 '15 at 11:31
  • @Stanislaw I've edited my answer to be a bit more specific about the exact issue. Thanks for the feedback. – concertman Sep 30 '15 at 14:36
  • This route requires updating the test once a year and if you are setting the day wheel the update has to happen everyday… – theMikeSwan Sep 13 '16 at 18:44