How to select random value from iOS picker wheel using Selenium

0 votes

I am performing my automation in real IOS device. In one of the aspect I have to automate a picker wheel

Image Attached Here

xpath:

//UIAApplication[1]/UIAWindow[1]/UIAPopover[1]/UIAPicker[1]/UIAPickerWheel[1]

I would like to select a random value from picker. I can able to do the by sending static value using SendKeys. Instead of the I want to select a random value.

Can I please know how can I do that using java??


 

Sep 21, 2022 in Others by gaurav
• 23,260 points
1,062 views

1 answer to this question.

0 votes

Two ways to do this :

  1. Randomise the UIAPickerWheel[1] index while you are using the x-path to access the elements.

  2. You can put all possible static values into an ArrayList and use a random element from amongst them to input using the sendKeys() in way some-what like this :

    ArrayList<String> list = new ArrayList<String>();
    list.add("value1"); 
    list.add("value2"); // so on for all your values
    Random randomizer = new Random();
    String random = list.get(randomizer.nextInt(list.size()));
    element.sendKeys(random);
answered Sep 21, 2022 by rajatha
• 7,680 points

Related Questions In Others

0 votes
1 answer

How to convert data from txt files to Excel files using python

Hi , there are few steps to ...READ MORE

answered Feb 16, 2022 in Others by Edureka
• 13,690 points
14,024 views
0 votes
1 answer

How to get landmarks from current location using google map in iphone?

You can achieve this by saving several ...READ MORE

answered Sep 20, 2022 in Others by Aditya
• 7,680 points
501 views
0 votes
1 answer

How to show caller image on iOS native ui call by using callkit framework?

Apple's CallKit is a framework introduced with iOS ...READ MORE

answered Nov 4, 2022 in Others by gaurav
• 23,260 points
1,357 views
0 votes
0 answers

How to show caller image on iOS native ui call by using callkit framework?

In my iOS app, I am using ...READ MORE

Sep 23, 2022 in Others by gaurav
• 23,260 points
477 views
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
13,673 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,142 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
7,221 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,874 views
0 votes
1 answer

iOS: Random black screen when loading the app

force restarting your iPhone You can always start ...READ MORE

answered Sep 21, 2022 in Others by rajatha
• 7,680 points
5,447 views
0 votes
1 answer

Is there a way to search the iOS app store online?

Apple finally made it possible to just use ...READ MORE

answered Sep 21, 2022 in Others by rajatha
• 7,680 points
3,927 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP