Highlighted
Liran1 Absent Member.
Absent Member.
1630 views

How to get HTTP status and user login Token when using Web Driven Browser

Hi,

We're using the Web Driven Browser (SP 18.0 version) in order to monitor some of our Ajax web based sites.

Since I'm more familiar with the low lever (HTTP) recordings I've got two questions regarding the Web Driven Browser capabilities:

1. If I need to capture and store user token after logging in into our web site (Microsoft Azure based), is there a way do it? 
     as far as I know and see the token data isn't stored anywhere in the code and can't be parsed in True Log. 

2. I've been asked to check the HTTP status after the page has been loaded. The reason for this is to help our NOC team to identify the problem without accessing the True Log (propagate the HTTPS status number into the TSPS event). Is it possible to do in WDB transactions?

Thanks in advance,

Liran.

0 Likes
11 Replies
Micro Focus Contributor
Micro Focus Contributor

RE: How to get HTTP status and user login Token when using Web Driven Browser

Regarding your two points:

" as far as I know and see the token data isn't stored anywhere in the code and can't be parsed in True Log"

Where is it stored? Or where can it be retrieved from?

For point 2, add a verification on the page which represents a successful load, and then create an event handler which will return a specific error, and error code if the verification does not succeed.
0 Likes
Liran1 Absent Member.
Absent Member.

RE: How to get HTTP status and user login Token when using Web Driven Browser

Hi Jonny,
Thanks for the response 🙂
Regarding point 1 - I can see the token inside the True Log break (left side of the True Log tree) but It can't be parsed into a token (as I usually did when recording in HTTP low level).
Regarding point 2 - I've created verification and event handlers but the error codes are related to Browser Engine errors ( (like BrowserEngine: 32 - Internet Explorer request failed) and not HTTP error codes.
0 Likes
Micro Focus Contributor
Micro Focus Contributor

RE: How to get HTTP status and user login Token when using Web Driven Browser

For point 1 do you mean the token is contained in the url? Can you attach an image of where you see the token in the truelog so I can provide a suggestion?

Does your page have customer facing error pages (such as displaying 404 to the user when it occurs)? If so verify the text of those. Beyond this suggestion, we have no way at this browser driven level to access the http status codes. Are you sure that your application needs to be monitored with browser driven approach and not the low level http approach?
0 Likes
Liran1 Absent Member.
Absent Member.

RE: How to get HTTP status and user login Token when using Web Driven Browser

Hi Jonny,

I've attached an image that shows the token in the URL

Regarding the second point, right now I'm still working with our Dev team on recording and creating the transaction so no customers facing any issues.

The Dev team wants to add those HTTP status so they have more information once our NOC team contacts them.

I'm using the Web Browser Driven level since the application is Angular based and from my understanding the WBD is the way to go when recording Angular applications (correct me if I'm wrong).

Thanks,

Liran.

0 Likes
Micro Focus Contributor
Micro Focus Contributor

RE: How to get HTTP status and user login Token when using Web Driven Browser

Use BrowserGetUrl function to retrieve the whole url and then StrSearchDelimited to cut out the part you need.
0 Likes
Liran1 Absent Member.
Absent Member.

RE: How to get HTTP status and user login Token when using Web Driven Browser

The BrowserGetUrl gives me the URL after the login was finished which means that the key is no longer at the URL.
Since the application is Angular based (one page application) once the authentication phase is completed, the URL is changing and no longer contains the token or any other information except from the application URL itself (like myapplication.com/.../dashboard)
0 Likes
Micro Focus Contributor
Micro Focus Contributor

RE: How to get HTTP status and user login Token when using Web Driven Browser

hi liran, as you are working close with your dev-devteam, can they provide/store the token at some obect/attribute/... within the page? with a BrowserExecuteJavaScript you could retrieve the value.
cheers, udo
0 Likes
Liran1 Absent Member.
Absent Member.

RE: How to get HTTP status and user login Token when using Web Driven Browser

Hi Udo,
The login page is Microsoft Azure authentication so I don't think they can assist me 🙂
Thanks,
Liran.
0 Likes
Liran1 Absent Member.
Absent Member.

RE: How to get HTTP status and user login Token when using Web Driven Browser

I don't know if it will clear what I'm looking for but here is an example from Google Development Tools:
Request URL: login.microsoftonline.com/.../confirmed
Request Method: GET
Status Code: 302 Found
Remote Address: 40.112.64.17:443
Referrer Policy: no-referrer-when-downgrade
Cache-Control: private
Content-Length: 1194
Content-Type: text/html; charset=utf-8
Date: Tue, 08 May 2018 13:41:07 GMT
Location: application.com/.../[tag:id]_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6InJmUzlPLVJKT01saklOSUpDaTNYaWd1TWlHSzJsQUNyQl94VGtxRXZLeHMifQ.eyJleHAiOjE1MjU4NzMyMDgsIm5iZiI6MTUyNTc4Njg2OCwidmVyIjoiMS4wIiwiaXNzIjoiaHR0cHM6Ly9sb2dpbi5taWNyb3NvZnRvbmxpbmUuY29tLzc1ZWE0YTU5LWFiMWEtNDQ3My1iYjJhLWE2YTc1MDUyODMwNi92Mi4wLyIsInN1YiI6IjA5MjVlMTFiLTE4YjktNDY3My05ODA4LTg1YmRiZDViNjE0ZiIsImF1ZCI6IjE5M2JhNWM3LT...

What i'm trying to save as a variable is the '[tag:id]_token=' value. I see it after the Request URL.
Thanks,
Liran.
Tags (1)
0 Likes
Micro Focus Contributor
Micro Focus Contributor

RE: How to get HTTP status and user login Token when using Web Driven Browser

MS provides the Azure Active Directory Authentication Libraries for obtaining tokens, so maybe there you can find some JS code to get that value via BrowserExecuteJavaScript.

 

0 Likes
Liran1 Absent Member.
Absent Member.

RE: How to get HTTP status and user login Token when using Web Driven Browser

HI Udo,
sorry for the late response I didn't work on this issue for a while.
I've tried to use BrowserExecuteJavaScript but the problem is that after the BrowserClick() function runs (clicking on the submit button), no other functions can be executed until the user is logged on and by that time I can't access the token anymore.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.