Selecting an item in a UIPicker

134 views
Skip to first unread message

Bryan Hansen

unread,
Aug 5, 2011, 5:46:43 AM8/5/11
to KIF iOS Automated Testing Framework
Is it possible to select a different value in a UIPicker for testing?

Bryan Hansen

unread,
Aug 5, 2011, 5:48:49 AM8/5/11
to KIF iOS Automated Testing Framework
I should have read the docs ;)

This method should work: stepToSelectPickerViewRowWithTitle

Eric Firestone

unread,
Aug 5, 2011, 6:05:09 AM8/5/11
to kif-fr...@googlegroups.com
Yup! That should do what you want. It's currently limited to single-column pickers, but expanding it to take a column number probably wouldn't be too difficult if you need it. Also, I just realized that it will try to hit "Done" for you when it's done, but the "Done" button isn't actually a guaranteed part of the picker. I've put out a pull request to fix this which should be merged tomorrow. What this means is that for most people, if you're using the -stepToSelectPickerViewRowWithTItle: step, you'll want to follow it with a -stepToTapViewWithAccessibilityLabel:@"Done".

Roopesh Manjunatha

unread,
May 20, 2013, 6:10:46 PM5/20/13
to kif-fr...@googlegroups.com
Hi Eric,

I have an issue with selecting the date from the UIDatePicker. After the [KIFTestStep stepToEnterDate:ticketsInHandDate ToDatePickerWithAccessibilityLabel:@"datePicker"]]; is executed the UIDatePicker is set to the given date
however my function 

- (IBAction)dateChangedAction:(id)sender
{
// If we invoke the setter, the original date will be overwritten.
[dateValue release];
dateValue = [datePicker.date retain];
dateCell.detailTextLabel.text = [[[self class] sharedFormatter] stringFromDate:dateValue];
   [self setDateTitleText:[[[self class] sharedFormatter] stringFromDate:dateValue]];
}
 is not being called. hence the dateValue is being to set to the new date. 

Please let me know if you have any ideas whats going on.



Thanks,
Reply all
Reply to author
Forward
0 new messages