How to usee variable in selectors

Hi,

This is my selector:
< webctrl id=‘daily-cal5’ tag=‘TABLE’ />

I would like to change ‘daily-cal5’ in the selector to a variable named updated_daily.

How can I do it?

thanks

@bhe98 you can the replace like this ’ “+variable name+” ’

doesn’t work tho.

< webctrl id=’ “+updated_daily+” ’ tag=‘TABLE’ />

@bhe98 what error it is showing.

object reference not set to an instance of an object

Hi @bhe98

You can use the expression editor to edit the selector. To access it, simple type into the selector expression bar you see in the properties.
Enter this:
“< webctrl id=’” +updated_daily.ToString+ “’ tag=‘TABLE’ />”
and ensure that updated_daily is defined in the scope.

If it fails, please share your .xaml

Cheers

@bhe98 can i have screenshot of entire selector before and after variable replacing.

sorry there was a problem uploading my file

I’ve attached a few images

Basically, I am trying to dynamically extract the table from https://www.dailyfx.com/economic-calendar
But the table changes everyday, and the selector changes according to the day of the week (friday= daily-cal5)

The selector before replacing was < webctrl id=‘daily-cal5’ tag=‘TABLE’ />

Don’t edit it in the selector editor. Copy and paste in the properties tab:
“< webctrl id=’” +updated_daily.ToString+ “’ tag=‘TABLE’ />”

If you want to open the expression editor instead of the selector editor when you click the three dots:
Click on the field beside the selector (not the 3 dots button), type a letter after the string, such as: "< webctrl id=‘daily-cal5’ tag=‘TABLE’ />"a
Click away, now click the three-dots button and it should open the expression editor.

The properties tab looks like this tho

or is there some other way to dynamically extract the table?

This is the properties tab. Paste the entire string there, do not click the 3-dots button since it opens up the selector editor

This is what it looks like

Expand the Target column by clicking the Plus icon

got it… but still doesnt work :confused:

Is your variable declared within the attach browser scope?

yep it is

do you know what the problem is ?

Preferably, I need to take a look at your .xaml file

Thanks Bryan