Getting cookies from current browser

I am trying to save cookies from current session of logged in user so that I could use the same to make API calls. I tried injecting JS to get the cookies but one of those is HttpOnly so it cannot be retrieved with JavaScript.

I have tried the Get Browser Data activity. I save the browser data in sessionData variable. When I log the sessionData, it shows me every other irrelevant cookie other than the one from current site. Please note that I do not have any other chrome window open. And my current chrome window is incognito. Chrome incognito is expected to have no previous cookies as per my understanding.

I went through the UiPath documentation as well as the forum but everything is outdated. I am on UiPath studio v2024.10.8.

Maybe I am missing something. I need your help with this.

How can I get cookies from current browser and log them or write them to a file?

@mrizwan

Welcome to the community

Is browser extension enabled for incognito?

Cheers

Thanks Anil.
Yes, the extension is enabled. Please see attached screenshot.

Is there really a way to get cookies from current browser? Has anyone previously done it successfully? If so, please share how you did it.

Here is what I was doing wrong. I was logging the variable for get browser data. The log was truncated at x characters. I then used the write text file activity for the same variable as a json. And the cookies i was looking for, were there.

Steps:

  • Use application / browser
  • log in to the application if needed
  • get browser data and save it to a variable
  • write text file .. use variable .. use the one created in prev step. i used filename.json to have a JSON file.
  • ctrl + f to find your cookie

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