Software Quality Assurance & Testing Asked by TheRealTeaLeaf on December 26, 2021
I am trying to scan the cookies of a specific page with selenium.
Unfortunately, the get_cookies()
method can only get the first-party cookies, but I am more interested in the 3rd party cookies. As far as I can see the easiest solution could be reading Cookies database file of the browser. I tested my idea with the normal chrome browser and it works fine, I can find the 3rd party cookies with all their details in this file – AppDataLocalGoogleChromeUser DataDefaultCookies
.
My problem that I can’t figure out where the webdriver.chrome browser is saving the cookies on my local pc. Can anybody help with this?
Launching chrome URL chrome://appcache-internals/
will give app cache path. This gives a path from where the profile is loaded
So now we can use this trick in a browser launched in selenium and enter this URL. Will display the different profile path as shown in the image below.
When You navigate this path in your window file explorer you will get the browser profile stored in a path AppDataLocalTempscoped_dir22252_1086323558Default
where scoped_dir22252_1086323558
is randomly created folder for each browser launch from selenium. Now you can get cookie file from this path
I hope this is your required output
You can automate this by launching the chrome URL chrome://appcache-internals/
and get the cookie filepath. Read the cookie file using SQLlite JDBC (since it is a SQLlite database) apply the SQL query and fetch the real data as you need
Answered by Mohamed Sulaimaan Sheriff on December 26, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP