# How to extract value from CSS Selector element

**URL:** <https://community.dynatrace.com/t/how-to-extract-value-from-css-selector-element/18676>\
**Category:** Real User Monitoring\
**Tags:** user-sessions\
**Created:** [December 3, 2018, 2:00pm UTC](https://community.dynatrace.com/t/how-to-extract-value-from-css-selector-element/18676 "2018-12-03T14:00:09Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yosi\_Neuman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/yosi_neuman/32/9845_2.png) [@Yosi\_Neuman](https://community.dynatrace.com/u/Yosi_Neuman)\
**Post date:** [December 3, 2018, 2:00pm UTC](https://community.dynatrace.com/t/how-to-extract-value-from-css-selector-element/18676/1 "2018-12-03T14:00:09Z")

</div>

Hi guys,

We are trying to get the value out of the follows element

\<input  
name=“ctl00$hdnUserNT”  
type=“hidden”  
id=“hdnUserNT”  
value=“ODCOHEN”  
/\>

When checking with querySelector we see the value

![19039-query.png](https://global.discourse-cdn.com/dynatrace/original/3X/4/a/4a4fbbdb0852c20fe91a5942f50d0f3253606847.png)

Within dynatrace we are trying to tag the user with #hdnUserNT@value or any other way the session but with no success.

Can it because of it start with input? or something else that we are missing or doing wrong?

Thanks in advance

Yos

---

<div class="post-metadata">

**Author:** ![radek\_jasinski](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/radek_jasinski/32/10432_2.png) [@radek\_jasinski](https://community.dynatrace.com/u/radek_jasinski)\
**Post date:** [December 3, 2018, 2:29pm UTC](https://community.dynatrace.com/t/how-to-extract-value-from-css-selector-element/18676/2 "2018-12-03T14:29:54Z")

</div>

Hi,

In the link below you have an explanation on how to correctly make a css selector:

_( **Answer** by Gautier B.)_ [https://community.dynatrace.com/questions/198298/cs…](https://community.dynatrace.com/questions/198298/css-selector-for-user-tagging.html)

Did you do it this way?

Radek

---

<div class="post-metadata">

**Author:** ![Yosi\_Neuman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/yosi_neuman/32/9845_2.png) [@Yosi\_Neuman](https://community.dynatrace.com/u/Yosi_Neuman)\
**Post date:** [December 3, 2018, 2:44pm UTC](https://community.dynatrace.com/t/how-to-extract-value-from-css-selector-element/18676/3 "2018-12-03T14:44:41Z")

</div>

Hi Radek,

Yes we used the copy css selector

When using Chrome it seem to work OK but all the users are using IE

Yos

---

<div class="post-metadata">

**Author:** ![skrystosik](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/skrystosik/32/21133_2.png) [@skrystosik](https://community.dynatrace.com/u/skrystosik)\
**Post date:** [December 3, 2018, 6:42pm UTC](https://community.dynatrace.com/t/how-to-extract-value-from-css-selector-element/18676/4 "2018-12-03T18:42:21Z")

</div>

@Yos N. the reason is that you are trying to get value from input. This rules are generaly (according to my knowledge) usefull for element like span, div etc, not for input. Because Dynatrace is trying to get not value of element, but content of element. For input it’s not possible. If code is managed by you, you can create extra element, or better, global JS variable which will provide value for you.

Regards,  
Sebastian

---

<div class="post-metadata">

**Author:** ![Yosi\_Neuman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/yosi_neuman/32/9845_2.png) [@Yosi\_Neuman](https://community.dynatrace.com/u/Yosi_Neuman)\
**Post date:** [December 4, 2018, 7:29am UTC](https://community.dynatrace.com/t/how-to-extract-value-from-css-selector-element/18676/5 "2018-12-04T07:29:32Z")

</div>

Hi Sebastian,

Thanks for the information

Will try to change the type of the filed and / or use a global JS varibale

Yos

---

<div class="post-metadata">

**Author:** ![waikeat\_chan](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/waikeat_chan/32/33405_2.png) [@waikeat\_chan](https://community.dynatrace.com/u/waikeat_chan)\
**Post date:** [December 4, 2018, 7:35am UTC](https://community.dynatrace.com/t/how-to-extract-value-from-css-selector-element/18676/6 "2018-12-04T07:35:42Z")

</div>

Yup, agree with Sebastian (Also based on experiences and failures I’ve ran into 🙂 although I couldn’t find any articles or knowledges or book that 100% confirm this).

But like Sebastian said, you would have a higher chances of success if try to extract it from value instead of users’ input. So maybe, try to extract it from web pages after login, instead of InputTextBox that wait for users input.

---

<div class="post-metadata">

**Author:** ![skrystosik](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/skrystosik/32/21133_2.png) [@skrystosik](https://community.dynatrace.com/u/skrystosik)\
**Post date:** [December 4, 2018, 8:00am UTC](https://community.dynatrace.com/t/how-to-extract-value-from-css-selector-element/18676/7 "2018-12-04T08:00:28Z")

</div>

You can also store this value in cookie if it’s easier for you 🙂 Generally most of the time we are asking clients for adding JS variable or cookie, because HTML and CSS can change over time and such rules may stop working (css selectors).
