Select an option from picker wheel using appium

In IOS,  we have UIPickerWheel element which will have options to select, we will see how we can automate the picker wheel using appium, a sample picker wheel is shown in below screenshot

We will see how we ca select an option from the picker wheel

we can use sendkeys method to select an option, in sendkeys method, send the option to chose as a parameter.

 

Watch the demo here

 

Here is the folder structure of the project – 

create a maven project as shown below screenshot

 

DatePickerWheel.java

Identify the picker wheel and use sendKeys() to send the string and select the option.

Even we can use hash map to scroll through the picker wheel to get all picker wheel options.

 

AppTest.java

To invoke the application

 

MobileDriver.java

Get the driver instance

 

TestApp.java

Actual testNG test to execute

 

testng.xml

 

You can find the pom.xml from here

Start the appium server and run the testng.xml to chose the pickerwheel option

Note : If you are new to appium, you can follow this below starter post to work with appium server

Appium server

Setup appium for android and ios

Content posted is based on learning or working experience,
Share the post with others if find useful,
Any queries?, leave comments or discuss on our facebook:qavalidation.com, Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *