Flutter App Date Picker using CupertinoDatePicker library automation issue

I am currently automating a Flutter app, and the developer has implemented a CupertinoDatePicker for date selection (screenshot attached). Upon inspecting the element properties, I found the relevant property specifically for the month selector. Although I can successfully inspect the element, I encounter an issue when attempting to select a different month using the sendKeys function. I have also attempted to use the JavaScript executor, but unfortunately, it has not resolved the problem. I am currently stuck at this point and seeking assistance. Any suggestions would be greatly appreciated. Thank you in advance.

[{“key”:“elementId”,“value”:“54000000-0000-0000-4719-000000000000”,“name”:“elementId”},{“key”:“type”,“value”:“XCUIElementTypeOther”,“name”:“type”},{“key”:“value”,“value”:“7”,“name”:“value”},{“key”:“enabled”,“value”:“true”,“name”:“enabled”},{“key”:“visible”,“value”:“true”,“name”:“visible”},{“key”:“accessible”,“value”:“true”,“name”:“accessible”},{“key”:“x”,“value”:“213”,“name”:“x”},{“key”:“y”,“value”:“553”,“name”:“y”},{“key”:“width”,“value”:“47”,“name”:“width”},{“key”:“height”,“value”:“183”,“name”:“height”},{“key”:“index”,“value”:“3”,“name”:“index”}]

Is any face similar type of issue and have any solution. Please let me know. Thanks

Your elements are TypeOther! but real iOS elements in such case are XCUIElementTypePickerWheel.
So you possibly cant work with them as with PickerWheel.

Normally with PickerWheel if you tap on up/down areas of value it scrolls to previous/next value. Try use this logic to set needed value. Tap and check that needed value set in loop.

1 Like

Thanks @Aleksei,
Do you mean I should scroll multiple times until I find the value I want? I will try that, but it will be time-consuming. For example, if today’s date is July 11th and I want to set a value for July 30th, I will need to scroll multiple times. If I scroll too quickly, the required element may get hidden and not appear in the DOM.

Additionally, after scrolling, if I check the date and it is confirmed that it is not available in the DOM, an exception will be thrown. In the exception block, I will have to scroll again. Dealing with these exceptions also takes time.

agree with you. possibly you can ask developers if they can use XCUIElementTypePickerWheel. Not sure if it possible with Flutter coding …

1 Like

Thank you @Aleksei for your input