# Selector as variable

**URL:** <https://forum.uipath.com/t/selector-as-variable/113861>\
**Category:** Help\
**Tags:** uiautomation, activities\
**Created:** [Mayıs 2, 2019, 12:12ös UTC](https://forum.uipath.com/t/selector-as-variable/113861 "2019-05-02T12:12:49Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Snowman](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/snowman/32/62826_2.png) [@Snowman](https://forum.uipath.com/u/Snowman)\
**Post date:** [Mayıs 2, 2019, 12:12ös UTC](https://forum.uipath.com/t/selector-as-variable/113861/1 "2019-05-02T12:12:49Z")

</div>

Hi,

I have a selector like this:

and I try to replace the id with a string variable in which I can have 1, 2, 3 or … at the end.

I change it to:  
  
where NewText is a string variable, eg. “bookedQtyId3”

But it return error saying that the UI element not found. Did I miss anything in my syntax ?

Thanks  
Snowman

---

<div class="post-metadata">

**Author:** ![lakshman](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/lakshman/32/523490_2.png) [@lakshman](https://forum.uipath.com/u/lakshman)\
**Post date:** [Mayıs 2, 2019, 12:14ös UTC](https://forum.uipath.com/t/selector-as-variable/113861/2 "2019-05-02T12:14:53Z")

</div>

@Snowman

Could you please paste screen shot of your selector here. I can’t see any selector in above post.

---

<div class="post-metadata">

**Author:** ![Snowman](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/snowman/32/62826_2.png) [@Snowman](https://forum.uipath.com/u/Snowman)\
**Post date:** [Mayıs 2, 2019, 12:19ös UTC](https://forum.uipath.com/t/selector-as-variable/113861/3 "2019-05-02T12:19:00Z")

</div>

Thanks a lot for your prompt response, and attached is the screen shot.  
It works when the selector is:  
  
But when I change it to the one as attached, it does not work…

 ![image](https://global.discourse-cdn.com/uipath/original/3X/f/a/fa31d12373285ebf34924b98da7f7e7418941a9e.png)

---

<div class="post-metadata">

**Author:** ![Snowman](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/snowman/32/62826_2.png) [@Snowman](https://forum.uipath.com/u/Snowman)\
**Post date:** [Mayıs 2, 2019, 12:25ös UTC](https://forum.uipath.com/t/selector-as-variable/113861/4 "2019-05-02T12:25:55Z")

</div>

It works when the selector is:

…Just don’t know why in my previous post, all the copy and paste of the selector doesn’t show up : (

---

<div class="post-metadata">

**Author:** ![Snowman](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/snowman/32/62826_2.png) [@Snowman](https://forum.uipath.com/u/Snowman)\
**Post date:** [Mayıs 2, 2019, 12:26ös UTC](https://forum.uipath.com/t/selector-as-variable/113861/5 "2019-05-02T12:26:41Z")

</div>

![image](https://global.discourse-cdn.com/uipath/original/3X/1/3/13cb3d1a2e80a74f5c043da4b18d419af7725e23.png)

---

<div class="post-metadata">

**Author:** ![Arunachalam](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/arunachalam/32/58238_2.png) [@Arunachalam](https://forum.uipath.com/u/Arunachalam)\
**Post date:** [Mayıs 2, 2019, 1:17ös UTC](https://forum.uipath.com/t/selector-as-variable/113861/6 "2019-05-02T13:17:14Z")

</div>

@Snowman,

I understand your point. can you please do below step you will get the solution.

1. Please delete the code inside edit attributes inside **Selector Editior**. and Click okay.
2. Please paste this code inside the select and click okay. **Don’t miss any characters**  
**`"webctrl = id='"+text+"' tag='INPUT'"`**  
 ![image](https://global.discourse-cdn.com/uipath/original/3X/0/c/0caa8a02b4ee67054302c6ebc61c559fc22b6162.png)
3. Run your bot. then it will work.

Thanks,  
Arunachalam.

---

<div class="post-metadata">

**Author:** ![Lahiru.Fernando](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/lahiru.fernando/32/523857_2.png) [@Lahiru.Fernando](https://forum.uipath.com/u/Lahiru.Fernando)\
**Post date:** [Mayıs 2, 2019, 1:24ös UTC](https://forum.uipath.com/t/selector-as-variable/113861/7 "2019-05-02T13:24:18Z")

</div>

Hi @Snowman

In your selector I see that you have “&quot” instead of double quotation. Remove these &quot word from the selector and replace them with the double quotation.  
It should look like  
`"webctrl = id='"+text+"' tag='Input'"`

When updating this selector, don’t open the selector editor. Go to the properties of the activity, and under the selector text box (without opening the editor), select all and remove what is existing and add the new selector as above.

It will work…

Let know whether it helps

---

<div class="post-metadata">

**Author:** ![Pablito](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/pablito/32/385495_2.png) [@Pablito](https://forum.uipath.com/u/Pablito)\
**Post date:** [Mayıs 2, 2019, 1:25ös UTC](https://forum.uipath.com/t/selector-as-variable/113861/8 "2019-05-02T13:25:06Z")

</div>

Hi @Snowman,

> [@Level 1 Lesson 6 Part 3 Dynamic Selectors](https://forum.uipath.com/t/level-1-lesson-6-part-3-dynamic-selectors/113732/8):
>
> Hi @sujoy_mukherjee, There is a known bug with dynamic selectors based on variable. If you will put you variable in selector editor as let’s say "+variable+" it will change it to quote;+variable+quote;. Please check if you don’t have situation like this. If you have you need to write your variable manually (not in UiExplorer) directly in selector text box → [image]. This should work. And don’t open selector with this ... button.

---

<div class="post-metadata">

**Author:** ![Snowman](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/snowman/32/62826_2.png) [@Snowman](https://forum.uipath.com/u/Snowman)\
**Post date:** [Mayıs 2, 2019, 2:03ös UTC](https://forum.uipath.com/t/selector-as-variable/113861/9 "2019-05-02T14:03:04Z")

</div>

Dear all,

Yeah!!! It works !

Thanks a lot

---

<div class="post-metadata">

**Author:** ![Arunachalam](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/arunachalam/32/58238_2.png) [@Arunachalam](https://forum.uipath.com/u/Arunachalam)\
**Post date:** [Mayıs 2, 2019, 2:11ös UTC](https://forum.uipath.com/t/selector-as-variable/113861/10 "2019-05-02T14:11:05Z")

</div>

@Snowman,

you are welcome. is there anything else your facing problem. if no please make as a solution.

Thanks,  
Arunachalam.

---

<div class="post-metadata">

**Author:** ![Snowman](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/snowman/32/62826_2.png) [@Snowman](https://forum.uipath.com/u/Snowman)\
**Post date:** [Mayıs 2, 2019, 2:17ös UTC](https://forum.uipath.com/t/selector-as-variable/113861/11 "2019-05-02T14:17:18Z")

</div>

Sure, and marked 3… but just found out that I can only mark once 🤔

Anyway, thank you @Arunachalam , @Pablito , and @Lahiru.Fernando

---

<div class="post-metadata">

**Author:** ![Arunachalam](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/arunachalam/32/58238_2.png) [@Arunachalam](https://forum.uipath.com/u/Arunachalam)\
**Post date:** [Mayıs 2, 2019, 2:18ös UTC](https://forum.uipath.com/t/selector-as-variable/113861/12 "2019-05-02T14:18:28Z")

</div>

@Snowman,

Haha. You are welcome again 😀

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/system/32/182466_2.png) [@system](https://forum.uipath.com/u/system)\
**Post date:** [Mayıs 5, 2019, 2:31ös UTC](https://forum.uipath.com/t/selector-as-variable/113861/13 "2019-05-05T14:31:47Z")

</div>

Kapattı, Mayıs 5, 2019, 2:31ös UTC tarihinde

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