Insert variable into selector

Hi all,

Need some help to insert variable into selector
image

Instead of Perth, i want to change it to something else in my variable named Input.

How should i do it?

Thank you for your help!

Hi @RPALearner1,

Refer this video

UiPath Tutorial For Beginners | Dynamic Selector in UiPath Part -2 - YouTube

Selector:

"<html app='firefox.exe' title='"+strTitle+"' />"

strTitle → string variable
strTitle =“THE 10 BEST Restaurants in Perth - TripAdvisor”

  • Asterisk (*) – replaces zero or more characters
  • Question mark (?) – replaces a single character

Regards,
Arivu

1 Like

@RPALearner1,

Replace Perth with this: ’ “+Cityname.Tostring+” ’

Hi @RPALearner1,

This is a sample for your question.

Original Selector:
“<html app=‘firefox.exe’ title='THE 10 BEST Restaurants in Perth - TripAdvisor />”

Variable:
Input

Expected Selector:
“<html app=‘firefox.exe’ title='THE 10 BEST Restaurants in '” + Input + “’ - TripAdvisor />”

HI @RPALearner1

replace your selector with this…
<html app='firefox.exe' title='The 10 BEST Restaurants in '" + CityName.ToString + "' - TripAdvisor'"/>

Hi there,

Any idea why it didn’t work? Tried to valid it.

Hi

Try pasting this…

"<html app=‘firefox.exe’ title=‘The 10 BEST Restaurants in '" + CityName.ToString + "' - TripAdvisor'/>"

image

@RPALearner1,

Why you are making a dynamic selector in a selector window, use an assign variable copy the whole selector from selector window and paste in assign and store the value in selector variable and pass selector variable in your activity.

Hi everyone,

You can now define your variables for selectors directly in Studio.

Please check our official documentation here:

As well as this short tutorial on our Forum:

I took the liberty to change the solution flag to this post to let our users know about this feature :slight_smile:

1 Like

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