30-04-25 04:27 PM
Pretty straightforward - is there any easy way to get the cookie values from a current chrome session? I could do it with Javascript, but hoping there is an 'in the box' way of doing it.
Thanks-
-RJ
Answered! Go to Answer.
05-05-25 10:28 AM
Hi @rj.latherow
Blue Prism doesn't appear to have a built-in method for extracting cookie values directly from a Chrome session. However, I came across an interesting tool on GitHub that might be useful for this scenario:
GitHub - barnardb/cookies: Command-line tool for extracting cookies from the user's web browser
Best Regards,
Sayeed Bin Abdullah
05-05-25 10:28 AM
Hi @rj.latherow
Blue Prism doesn't appear to have a built-in method for extracting cookie values directly from a Chrome session. However, I came across an interesting tool on GitHub that might be useful for this scenario:
GitHub - barnardb/cookies: Command-line tool for extracting cookies from the user's web browser
Best Regards,
Sayeed Bin Abdullah
29-05-25 08:22 PM
To close this out- Sayeed Bin Abdullah's tip led me down a few rabbit holes. In the end, I was able to accomplish what I wanted using the Selenium driver in the BP Automate Root folder to get the entire cookie collection as a string to use in HTTP requests. It is currently working perfectly for all cookies, for now. I think that is the only 'easy' way.
Sunday
Initial i built the object flow to extract cookies from network tab and later we written the selenium code to fetch the cookies.
Can you please share your solution or code here , want to know how you are fetching the cookies
i am using below code to fetch
Dim options As New ChromeOptions()
options.DebuggerAddress = "127.0.0.1:9222"
Dim service As ChromeDriverService = ChromeDriverService.CreateDefaultService()
service.HideCommandPromptWindow = True
Dim cookiesString As String = ""
Dim driver As IWebDriver = New ChromeDriver(service, options)
Dim cookies As IReadOnlyCollection(Of OpenQA.Selenium.Cookie) = driver.Manage().Cookies.AllCookies
' Iterate through the cookies and print their details
For Each cookie As OpenQA.Selenium.Cookie In cookies
cookiesString &= cookie.Name & "=" & cookie.Value & ";"
Next
driver.Quit()