I am using the click activity to click on various option in the drop down list by fetching values from the excel sheet using while loop. But I am getting the below error message.
“The selector is not valid”
Exception Type: uiPath.Core.InvalidSelectorException
I have followed the below method.
Assigned as below
varSelect=BranchDetails.Rows(rowNumber)(“Select Brand”).ToString
selectorContent=“”
And in the click activity, I have used the variable selectorContent.
The value is getting fetched and getting the selector not valid error. I also have tried using the Expression Editor like suggested in other posts. But still getting the same error. Would really appreciate if someone could help me to understand where the issue is.
Note: If i pass the direct value the varSelect, it does work.
if the variable selectorContent which used in selector is blank then selector will be invalid. you have to pass some value or you can use * for making it dynamic.
check the selector is valid or not in UIexplorer.
I’m unable to understand why you need selectorContent if it is working with VarSelect
Yes, the aanames are the same as that of the dropdown.
Instead of passing the entire selector as a variable, i tried the giving the below syntax in the selector of the click activity. But still doesnt work. Is the below syntax correct for passing the variable varSelect?
I think I figured out where the problem could be.
Looks like the first value (Ben’s Cafe) in the excel has a special character. To test, i assigned the rowNumber to 1 and it works as the rest of the values in the excel are just strings. So I think the problem is with the “variable type”. I tried declaring my variable varSelect both as “string” and “GenericValue”. But looks like am missing something as it still doesnt work. Any thoughts?
@Manish, thank you so much for your suggestion to look into the aanames which helped me to narrow down the issue. @Sreelatha, thank you so much for teaching me another syntax and trying to help me out. @kuppu_sami, thank for your time in trying to help me out.
Looks like i had to use regular expression to fix the issue of getting the “selctor not valid” issue as the drop down had values with the special character “'”.
“<webctrl aaname=’ “& varSelect.ToString.Replace(”'”,“*”) &" ’ parentid=‘data.brand_id’ tag=‘SPAN’ />"