cancel
Showing results for 
Search instead for 
Did you mean: 

Reading Chrome cookie value

rj.latherow
Level 4

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

1 BEST ANSWER

Helpful Answers

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

View answer in original post

3 REPLIES 3

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

rj.latherow
Level 4

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.

naveed_raza
Level 6

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