Reputation: 11
Could you please help me out in entering the text in search bar using UIAutomation scripts for IPhone Application.
Thanks in advance, Madhu.
Upvotes: 1
Views: 3084
Reputation: 4592
Since through tap input method you communicate with the device, you can try user-like type of action: tapping.
To bring up the keyboard you just tap on the text input field:
someTextInputField.tap();
But be aware of the fact that there is no keyboard object instance available for actions if you do not activate the keyboard itself by tapping on any text input field.
Once the keyboard is activated:
var App = UIATarget.localTarget().frontMostApp();
var Keyboard = App.keyboard();
var Keys = Keyboard.keys();
var AltKeys = Keyboard.buttons();
Where AltKeys
represent service buttons like Shift, Done, etc.
And Keys
represent all other buttons.
P.S. Keep in mind that you have to switch between keyboard tabs to get access to either characters, numbers, special characters.
Upvotes: 0
Reputation: 338
UIASearchBar inherits from UIATextField:
Try the "setValue" method:
searchBar.setValue("search for this");
Upvotes: 4