How do I pass a variable to a selector in 'get-attribute' activity?

Hi All,
I am trying to pass a variable to the ‘get-attribute’ activity but don’t know how to. Basically, I am using web scraping to extract a web table in a data table and for each row, I want to look for a specific HTML tag on the web-page. The url in get-attribute is:

Number 11 is the row number which is hard coded in this example. I want the ‘for-each row’ to insert the RowNumber into this so it loops through all the rows and finds the attribute using get-attribute activity. I also tried making a variable for the selector that I can use in get-attribute called VarSelector ("<webctrl parentid=‘tb_WebGrid2_‘tableRow=’"+RowNumber+"’ tag=‘SPAN’ />") but I cant figure out how to insert this in the get-attribute selector. I have attached a screenshot below. Any help is greatly appreciated. THANKS FOLKS!
Screenshot_1|522x500

Hi @jaspreet1003

here is how you do it

"<webctrl parentid=‘tb_WebGrid2_‘tableRow=’"+RowNumber.ToString+"’ tag=‘SPAN’ />" 

And in the properties panel on the right you can see the ‘target’ field where the selector text-box lies. Just delete everything and paste the above and you will get your dynamic selector.

1 Like

you were almost done
in the Target property - pass this selector as a string between double quotes to SELECTOR property

Cheers @jaspreet1003

1 Like

This post should help you.

1 Like

It says invalid selector

actually we need to pass as a string in the field itself
not in the selector editor
can i have a view on the property panel a screenshot if possible
Cheers @jaspreet1003

@Palaniyappan Thanks for your help Palaniyappan! I was able to use sawaseem’s post above to solve it. Basically, the selector needed to be edited in the Expression editor instead of selector editor. I appreciate you helping me!

1 Like

@Raghavendraprasad ! Thanks for helping me. I was able to use sawaseem’s post above to solve it. Basically, the selector needed to be edited in the Expression editor instead of selector editor. I appreciate you helping me!

Great
Cheers @jaspreet1003

@sawaseem YOU ARE AWESOME MY MAN! yeah, Basically, the selector needed to be edited in the Expression editor instead of selector editor. The funny thing is it took couple of clicks on 3 dots before the expression editor popped up. Also, I found another way to bring up the expression editor - if I change the variable type for the variable used in the selector, that also brought up the expression editor. I appreciate you helping me! THANKS!!

1 Like

@jaspreet1003
Good to know that it worked. Thanks for the update too.!:+1:

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