cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to extract value from CSS Selector element

Yosi_Neuman
DynaMight Guru
DynaMight Guru

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

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

 

dynatrace certificated professional - dynatrace master partner - Matrix Soft Ware Division - Israel
6 REPLIES 6

radek_jasinski
DynaMight Guru
DynaMight Guru

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...

Did you do it this way?

Radek


Have a nice day!

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


dynatrace certificated professional - dynatrace master partner - Matrix Soft Ware Division - Israel

skrystosik
DynaMight Guru
DynaMight Guru

@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


Regards, Sebastian

Hi Sebastian,

Thanks for the information

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

Yos


dynatrace certificated professional - dynatrace master partner - Matrix Soft Ware Division - Israel

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).


Regards, Sebastian

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.


Featured Posts