Posts: 6
Threads: 3
Joined: Dec 2013
Reputation:
0
12-06-2013, 08:25 AM
How I can choose a random value from a drop-down?
Example:
Browser("e.........Login").Page("...........").WebList("Manufacturer").Select "ABC"
I want to select different values from manufacturer drop-down
Posts: 1,003
Threads: 1
Joined: Jul 2009
Reputation:
5
12-06-2013, 08:29 AM
Parameterize your input.
Code:
strVal = "ABC"
Browser("e.........Login").Page("...........").WebList("Manufacturer").Select strVal
Or you may,
Code:
Find "AllItems" and store it in an "Array"
Loop using a "For Next" and Check if it is the desired string and Select the required Item.
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Posts: 6
Threads: 3
Joined: Dec 2013
Reputation:
0
12-06-2013, 08:44 AM
Thanks basanth27 ! I appreciate your quick response.
For option 1: variable strVal have value “ABC” So it is not random, manufacture value will remain “ABC”. I want to select different values every time I run my script
For Option2: It is selection all the values from the drop-down.
Posts: 1,003
Threads: 1
Joined: Jul 2009
Reputation:
5
12-06-2013, 08:55 AM
If your case is that you dont care what the value is selected then you may use the RandomNumber and assign that value as an index to be selected.
Let's say you have 20 manufacture's names in the dropwdown and you have to select anything each time you run the script.
Code:
sRandNum = RandomNumber(1,20)
Browser("e.........Login").Page("...........").WebList("Manufacturer").Select sRandNum
Does this help?
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Posts: 6
Threads: 3
Joined: Dec 2013
Reputation:
0
12-06-2013, 08:59 AM
Thanks Basanth! This is what I was looking for since morning.
Posts: 1,003
Threads: 1
Joined: Jul 2009
Reputation:
5
12-06-2013, 09:01 AM
Happy to Help
Most Welcome.
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.