I am working on assignment 2 on advanced training, where I have to use a variable/argument inside a selector to make it dynamic inside a click activity. But as soon as I use a variable/argument inside Edit Selector, it becomes invalid, and test run also fails.
This is where you need to select an item from a combo box (or drop down?).
I have to use an argument in_Year to make the selector dynamic.
For your information, I checked “Simulate Click”.
My another related question is, when I indicate an element, should I choose the whole combobox element? Or the menu inside? Look at the image below.
buddy mention like this @tomato25
aaname = ’ " + in_year + " ’
and pass the whole selector as string to the property and don’t change in the selector editor as it wont take it at all, use the above expression for dynamic year clicking and how to use a selector as a string kindly have a view on the below link
Thanks for the quick reply, but I am still confused.
I do type it as aaname=‘" + in_Year + "’, but when I click OK, and reopen the Edit Selector, it has automatically changed the double quote as &quo t;.
Also, what do you mean by pass the whole selector as string to the property?
Also, could you please help me with my other question written in the last paragraph of my original question? Thanks!
yes buddy the one we mentioned in " will get converted to quot
and this one, try to pass the selector within double quotes as string to selector property in click activity, for more info on how to do that see the link suggested above buddy
the reason is making changes in selector editor with variable wont work, only when we place the selector with variable and send them as a string within double quotes to the selector property, it will take the variable that we have assigned @tomato25
But when I run the program, nothing happens. The combobox item won’t get selected.
I don’t know what is wrong with this.
Also, could you please answer my question in my original post? >> My another related question is, when I indicate an element , should I choose the whole combobox element? Or the menu inside? Look at the image below.
By the way, I forgot to check “Simulate click” in the gif, but even after I checked it, it still didn’t work. I even got an error at the end of failed execution. (Check below)
ok lets do one thing remove that click activity
add a new click activity and click the year box
add another click activity and press F2 and we will be getting a time lapse of 2 seconds and within that time we can select the year we want
then use that selector to click the year you want
Kindly try this and let me know buddy
Cheers @tomato25
Okay, it worked. If I use 2 different click activities (one for clicking the combo box, and one for actually selecting an item from the combo box), it works.
Now, my problem is, how can I select an item specified in a variable or an argument?
In this practice program, I can select 2018 because I know that is what the instruction says, but in the real word project, I don’t know what item needs to be selected, and it might depend on whatever value that is stored in a variable.
Fine in that case
We need to use a attach browser activity first
Within which we have to keep all these activities that would make sure that the elements are getting identified by the bot
–we can either use a click activity on the box followed by type into activity that would type the year we want that is saved in a string variable so that the cursor will be taken to that year and again a key with enter.
–or we can make a first click on the year box and another click as we did with F2, but here we are going to replace the value of 2018 by a variable like this