Capturing session information

Hello,

I’m trying to capture the session information into a HAR file. But when I run my robot test, I could see that the HAR file is getting created. However, the file contains limited session information.

Libraries Used:
Browser, BuiltIn, JSONLibrary

Here is the content that I could see in my generated HAR file

{‘log’: {‘version’: ‘1.2’, ‘creator’: {‘name’: ‘Playwright’, ‘version’: ‘1.19.2’}, ‘browser’: {‘name’: ‘chromium’, ‘version’: ‘100.0.4863.0’}, ‘pages’: , ‘entries’: }}

Note: ‘pages’ and ‘entries’ are empty in the generated HAR file

Robot Keywords:

Configure HAR
${har_config}= Create Dictionary path=${HAR_FILE_PATH}
Log to console HAR config is ${har_config}
New Context recordHar=${har_config}

Parse HAR
${json}= Load Json From File ${HAR_FILE_PATH}
Log to console ${json}
@{urls}= Get Value From Json ${json} $.log.pages
Log to console ${urls}

Please can someone help me here to capture the whole session information

Many thanks in advance

Hi Team,

Can someone please help me out here with this

Many thanks in advance.
Hemanth

i think i got it. har file got the stuff when i did put the “New Page” right after HAR configure.

${har_config}=
        ...    Create Dictionary
        ...    path=${HAR_FILE_PATH}
        ...    omitContent=True
        New Context    recordHar=${har_config}
        New Page    http://${URL}      # This one did the trick