Difficulties with selectors and variables

selector
studio
variable

#1

Hi,

I want to select an item from a dropdown menu but it does not work.
I can open the dropdown menu with or a click activity or with hotkeys and then selecting the right choice with a click activity. I opened the Ui explorer for making the selector perfect. Everything works fine like this. But I wanted to let the choice of the dropdown menu depending on an input of the user so I tried first making a variable with exactly the same string as the attribute aaname of the selector and put the variable into the selector with text editor (aaname=’"+variabele+"’) but like this it gives an error saying that it does not find the element with the selector however the error message showing exactly the same selector as before (without the variable), any idea what might be the problem here ??


#2

@Siene
Try like this

Use Input Dialog activity and take the input as a variable.
Then Pass the same variable in select Item activity.
Try it Iam not sure whether it will work or not :grinning:

Regards,
Mahesh


#3

Thanks for the answer but I did not worked …
really strange, when I copy the string in the dropdown menu and put it into a string variable it works …
when I make other variable and type just exactly the same string andperform same actions is cannot find the element …


#4

I tried with a dropdown menu of a different website and this works just fine …
Can it have something to do with maybe fomat of text on a website ???


#5

Hi @Siene

Refer this

Regards,
Arivu


#6

you can try below options,

  1. Navigate to- you can mention link which it is navigating after after clicking on menu item.

  2. click image - use click menu first as soon as menu is open use click image to click image item.


#7

Thank you!
It worked with the findChildren activity !
but now I have a different problem, my input value is more text than the dropdown value is (input value contains value of the dropdown item, so like this I have to click on the item of the dropdown menu). I checked it with a IsMatch activity but no luck …
maybe I made a mistake with my pattern ??
Below you can find all the variables used for this regular expression …

Pattern


#8

You can use Dictionary(Key, Value) here, map the input values with drop down values.


#9

Yes it works now! thank you


#10

Hi sorry I was to fast, I thought it worked but it still doesn’t work…
I thought I could use the dictionary but I cant. if I have to loop between 20 dropdown menus its not so handy to use a dictionary …
I tried also the String.contains method but also this one does not seem to work. It does not work when I extract the text from the dropdown menu into a variabele and use this variabele into the contains method, BUT the string.contains method works perfectly fine when I type exactly the same words of the dropdown menu into “” in the contains menu ??
I’m getting a ltille bit desperate here :stuck_out_tongue:


#11

I think for loop is not required when you use dictionary.
You can always use dictionary.ContainsKey or dictionary.ContainsValue also you can use select

try attached workflow, it may helpUsingDictionary.xaml (8.2 KB)