Cannot validate a selector on Click activity

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.

testC

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.
testD

1 Like

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

Cheers @tomato25

1 Like

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

1 Like

were you able to click now buddy @tomato25

1 Like

Nope. I don’t know what I am doing wrong. Instead of opening the Selector editor, I directly edit within the property window. But it is not working.

First, I am passing in_Year argument from another workflow, and I am giving it a default value of “2018” as string.

I add click activity, and indicate element on the combo box.
Now, from its property’s selector, I directly modify it from

“< html title=‘ACME System 1 - Reports - Upload Yearly Report’ />< webctrl aaname=‘—’ parentid=‘searchForm’ tag=‘BUTTON’ />”

to

“< html title=‘ACME System 1 - Reports - Upload Yearly Report’ />< webctrl aaname='” + in_Year + “’ parentid=‘searchForm’ tag=‘BUTTON’ />”

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.

1 Like

this one is correct buddy
image

and
“< html title=‘ACME System 1 - Reports - Upload Yearly Report’ />< webctrl aaname=’” + in_Year + “’ parentid=‘searchForm’ tag=‘BUTTON’ />”
is correct
kindly proceed now and check buddy
Cheers

1 Like

Look at my gif file I attached, and could you tell me what I am doing wrong?
It is still not working… (Check 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)
fail

1 Like

try with this selector buddy @tomato25

****make sure that it is inside a attach browser activity then only it will click
Cheers

1 Like

sorry for that

1 Like

were you able to click now buddy @tomato25

1 Like

No sir. I was using IE, and I changed it to Google Chrome, but it still does not work.

I am so lost…

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

1 Like

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.

In cases like that, how can I do this?

1 Like

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


And pass this selector as a string to the string property in click activity

Kindly try this and let know whether this works or not
Cheers @tomato25

2 Likes

Thank you @Palaniyappan for all these replies and help! I learned a lot from you!

1 Like

No worries @tomato25
Cheers

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.