录制器生成以下代码,但click()
始终单击年份字段。我在录制时点击了各个字段。
let startDateDatePicker = sheetsQuery.datePickers["Start Date"]
startDateDatePicker.click()
startDateDatePicker.typeText("1")
startDateDatePicker.click()
startDateDatePicker.typeText("1")
startDateDatePicker.click()
startDateDatePicker.typeText("2016")
设置日期选择器UI元素的推荐方法是什么?
答案 0 :(得分:1)
startDateDatePicker.dateValue = foo
?
编辑:既然我知道你真正想做什么,试试这个:
datePicker.coordinate(withNormalizedOffset: CGVector(dx: 0.1, dy: 0.5)).click()
datePicker.typeText("1")
datePicker.coordinate(withNormalizedOffset: CGVector(dx: 0.3, dy: 0.5)).click()
datePicker.typeText("2")
datePicker.coordinate(withNormalizedOffset: CGVector(dx: 0.6, dy: 0.5)).click()
datePicker.typeText("1934")