Pass variable to click on text from list

Good morning guys,
I have to click on text dynamically taking value from the excel.
refer below img

the selector for that menu list is " "
i have to pass variable " parentid = " here
as shown below
image

i tried below method

getting below error
image

Please correct me and suggest me solution for same.

First of all, place the entire selector in a string type variable and pass the dynamic variables. Then check if the value is being replaced in the string. If it is as required, then pass it to selector of the activity @prashantP

Hi @prashantP

Go inside the selector property and then remove &quot pass it inside as’“+strvalue.ToString+”’

Thanks
Ashwin.S

Hi
kindly dont pass the variable here in the selector editor
the way you have mentioned like ’ " + B2.ToString + " ’ is perfect, but when we are trying to pass the variable to a selector, once after mentioning the variable in the selector, we need to copy the whole selector from selector editor and pass that as a string value between double quotes to the SELECTOR - PROPERTY in the property panel of Click activity
"<app=’ …>
parentid = ’ " + B3.ToString + " ’ tag =‘A’ "

like this between double quotes as a string to the SELECTOR property
this would work for sure

the reason is when we are adding the variable as it is in selector editor itself it wont take the variable and its value while clicking the element and thus gives us this error

even after passing the variable and the selector as a string to the property if that doesnt click then we need to check the selector and its attribute

kindly try this and let know for any queries or clarification
Cheers @prashantP

Hi @Palaniyappan
Thanks for replay.
assign value to tmp variable and my output is also correct refer below img

now,
please let me know where and how exactly i have to assign variable ??
refer below img

pls Let me know.

1 Like

First of all, avoid passing the dynamic values in the selector (to make it as a standard practice ),

Pass the entire selector to a string type variable and then do string manipulations in the assign activity itself before passing it to the activity.

Once you assign all the values dynamic, I mean after assigning the variables in the selector string, then pass that selector to the activity

1 Like

perfect
so copy this selector
image

and pass it like a string variable here in this selector property between double quotes


here in the property panel (not in the SELECTOR EDITOR)
image

yah with @HareeshMR suggestion, i would term it like passing variables to the selector in place of attribute values is fine but avoid passing the nodes or elements for a selector. Pass it as a complete selector.

hope this would help you
Cheers @prashantP

2 Likes

Hi @Palaniyappan & @HareeshMR
I tried as you said but still getting error.

assigned

Passed into selector
Note :- I am using Click Text activity.

getting error.

note : inside title i put * is that reason to getting error ??

1 Like

no kindly remove this double quotes
image

only in the beginning and at the end of the selector like a normal string value
Cheers @prashantP

@Palaniyappan
Still getting error “selector not valid”
what about * how to put that same as variable ?

“<webctrl tag=‘A’ aaname='”+B4.ToString+“‘’ />”

Do this @prashantP,

Open the browser page which you are trying to select in the background and then change the selector with asterisk(*) once and then validate. If it validates, then you can use * in that place

and why dont you pass the selector as a variable instead of passing directly. Kindly do that

@HareeshMR
Validation is done.

and I passing variable now but still not working.
kind check last replay screen shot’s

@Palaniyappan did you find anything correction or changes ??

Can you post the selector you are getting in the tmp variable?

As I see, you are passing two single quotes (') at two places , please try by sending one single quote

Good morning @HareeshMR
Please check and let me know which single quotes.

“<html title=‘Yardi Systems,*’/
<webctrl tag=‘A’ aaname='”+B3.ToString+“‘’ />”

passing variable

Error

If you check there, you are sending two single quotes after the variable you are passing @prashantP

May be that will cause the issue

@HareeshMR
I am not which quotes you are talking about.

Can you please highlight ??

@HareeshMR
You are right.
at the end there is one quote is extra – ’”+B3.ToString+"’’

thank you guys…:-:love_you_gesture::love_you_gesture:

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

Hi @prashantP

There is a feature in Studio that allows you to use variables in your selectors, please see here:

1 Like