How to select a localized date picker item in an iOS UItest
<p>I have a picker view with a date picker created in Interface Builder. In the Attributes Inspector is selected: Mode "<strong>Date and Time</strong>". In my UI test I need to select a specific <strong>Date and Time</strong> from it. I am using the XCTest UI testing APIs that were intruduced with Xcode 7.</p>

<p>My testing code for a localized united states date and time picker looks like that:</p>

<pre><code>app.tables.pickerWheels.elementBoundByIndex(0).adjustToPickerWheelValue("Jun 29")
app.tables.pickerWheels.elementBoundByIndex(1).adjustToPickerWheelValue("12")
app.tables.pickerWheels.elementBoundByIndex(2).adjustToPickerWheelValue("10")
app.tables.pickerWheels.elementBoundByIndex(3).adjustToPickerWheelValue("PM")
</code></pre>

<p>which will work perfect!</p>

<p>My testing code for a localized german <strong>date and time picker</strong> looks like that:</p>

<pre><code>app.tables.pickerWheels.elementBoundByIndex(0).adjustToPickerWheelValue("29. Juni")
app.tables.pickerWheels.elementBoundByIndex(1).adjustToPickerWheelValue("07")
app.tables.pickerWheels.elementBoundByIndex(2).adjustToPickerWheelValue("10")
</code></pre>

<p>in this case I got following exception:</p>

<p>Assertion Failure: UI Testing Failure - Internal error: unable to find current   value <strong>'(null)'</strong> in possible values 11. Mai, 12. Mai, 13. Mai, 14. Mai, 15. Mai, 16. Mai, 17. Mai, 18. Mai, 19. Mai, 20. Mai, 21. Mai, 22. Mai, 23. Mai, 24. Mai, 25. Mai, 26. Mai, 27. Mai, 28. Mai, 29. Mai, 30. Mai, 31. Mai, 1. Juni, 2. Juni, 3. Juni, 4. Juni, 5. Juni, 6. Juni, 7. Juni, 8. Juni, 9. Juni, 10. Juni, 11. Juni, 12. Juni, 13. Juni, 14. Juni, 15. Juni, 16. Juni, 17. Juni, 18. Juni, 19. Juni, 20. Juni, 21. Juni, 22. Juni, 23. Juni, 24. Juni, 25. Juni, 26. Juni, 27. Juni, 28. Juni, <strong>29. Juni</strong>, 30. Juni, 1. Juli, 2. Juli, 3. Juli, 4. Juli, 5. Juli, 6. Juli, 7. Juli, 8. Juli, 9. Juli, 10. Juli, 11. Juli, 12. Juli, 13. Juli, 14. Juli, 15. Juli, 16. Juli, 17. Juli, 18. Juli, 19. Juli, 20. Juli, 21. Juli, 22. Juli, 23. Juli, 24. Juli, 25. Juli, 26. Juli, 27. Juli, 28. Juli, 29. Juli, 30. Juli, 31. Juli, 1. Aug., 2. Aug., 3. Aug., 4. Aug., 5. Aug., 6. Aug., 7. Aug., 8. Aug., 9. Aug., 10. Aug., 11. Aug., 12. Aug., 13. Aug., 14. Aug., 15. Aug., 16. Aug., 17. Aug., 18. Aug. for the picker wheel "Heute" PickerWheel</p>

<p>I presume, that the <strong>'(null)'</strong> says that there is no search string set for the UITest query:</p>

<pre><code>app.tables.pickerWheels.elementBoundByIndex(0).adjustToPickerWheelValue("29. Juni")
</code></pre>

<p>and this is the reason for rising this exception.</p>

<p>The described problem appears only when the simulators preferences "<strong>General / Language &amp; Region</strong>" are not set to default <strong>"United States"</strong>.</p>

<p>When I switch to other language settings in the simulator, I got this the same results with my own swift code above as well as the Objective-C code referred in following posting:</p>

<p><a href="https://stackoverflow.com/questions/31257409/how-to-select-a-picker-view-item-in-an-ios-ui-test-in-xcode">How to select a picker view item in an iOS UI test in Xcode?</a></p>

<p>I definitely have to perform my UITestings with a localized <strong>date and time picker!</strong>
Does anybody have an idea, what´s going wrong here and if there is a solution for it ?</p>