Open bluemangofunk opened 7 months ago
@usr741852 May I ask you how you pass the cookies in set_all(), please? I haven't been able to add any cookie using this function, even making the changes that you stated.
@usr741852 May I ask you how you pass the cookies in set_all(), please? I haven't been able to add any cookie using this function, even making the changes that you stated.
I just commented out the line:
#cookies = await connection.send(cdp.storage.get_cookies())
then cookies would work. If that is NOT working for you, are you sure you are passing them incorrectly?
anybody can help putting here how use nodriver to get cookies? for example i have this with undetected chromedriver
def do_login(username, password): options = uc.ChromeOptions() options.add_argument("--headless") driver = uc.Chrome(options=options) driver.get("https://account.xxxxxxxxxxxxxxxxxxxxxxxF") cookie = driver.get_cookie("reese84") reese84 = cookie['value'] driver.quit()
how can i use with nondriver????
where can i see this command??cookies = await connection.send(cdp.storage.get_cookies()) i dont see it where is it
don't spam the issue tracker. this is not an issue.
cookies =await tab.send(cdp.storage.get_cookies())
await tab.send(cdp.storage.set_cookies(cookies))
thank for reply mate, but i dont understand how put this command in the proof i sent you, using nodriver, can you complete a little bit, and if i want a cookie not all cookies?? and can you show modules tu use, thanks in advance
i have this await browser.cookies.save(file="cookie.json") to copy cookies en a json
await browser.cookies.load(file="cookie.json")
cookies =await tab.send(cdp.storage.get_cookies())
get_cookies returns a list of cdp.network.Cookie objects.
You can mutate the list, remove and add new ones then to set them just pass that list of cookies to set_cookies
If you don't know how this works you're in the wrong place. And I'd advise a python refresher
Hello friends, Since the input is a json array, it worked like this: cookies_json=[....] # list of elements json cookies = list(map(lambda x: uc.cdp.network.CookieParam.from_json(x), cookies_json))
then do: await page.browser.cookies.set_all(cookies=_data_cookies)
if you want, can check: for i in await page.browser.cookies.get_all(): print(i)
cookies = await page.send(cdp.storage.get_cookies()) hangs. Is this a known issue?
import asyncio
import nodriver as uc
from nodriver import cdp
async def main():
browser = await uc.start()
page = await browser.get('https://www.nowsecure.nl')
await page.save_screenshot()
cookies = await page.send(cdp.storage.get_cookies())
print(cookies)
if __name__ == '__main__':
# since asyncio.run never worked (for me)
uc.loop().run_until_complete(main())
Yes. It is worked.Enviado do meu iPadEm 4 de jul. de 2024, à(s) 01:21, Danofun @.***> escreveu: cookies = await page.send(cdp.storage.get_cookies()) hangs. Is this a known issue? `import asyncio import nodriver as uc from nodriver import cdp async def main(): browser = await uc.start() page = await browser.get('https://www.nowsecure.nl') await page.save_screenshot() cookies = await page.send(cdp.storage.get_cookies()) print(cookies)
if name == 'main':
uc.loop().run_until_complete(main())`
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>
Yes. It is worked.Enviado do meu iPadEm 4 de jul. de 2024, à(s) 01:21, Danofun @.> escreveu: cookies = await page.send(cdp.storage.get_cookies()) hangs. Is this a known issue?
import asyncio import nodriver as uc from nodriver import cdp async def main(): browser = await uc.start() page = await browser.get('https://www.nowsecure.nl') await page.save_screenshot() cookies = await page.send(cdp.storage.get_cookies()) print(cookies) if name == 'main': # since asyncio.run never worked (for me) uc.loop().run_until_complete(main())
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.>
Appears to work properly after rolling back to nodriver version 0.29rc2. Does not work for me on the 7/1 release of 0.30.
cookies = await page.send(cdp.storage.get_cookies()) hangs. Is this a known issue?
import asyncio import nodriver as uc from nodriver import cdp async def main(): browser = await uc.start() page = await browser.get('https://www.nowsecure.nl') await page.save_screenshot() cookies = await page.send(cdp.storage.get_cookies()) print(cookies) if __name__ == '__main__': # since asyncio.run never worked (for me) uc.loop().run_until_complete(main())
Yes, it hangs for me as well. Seems to be a new issue introduced in 0.30.
It hangs for me as well. Very strange.
it does return them when running it in full manual mode:
import json
await page.websocket.send(json.dumps({'method': 'Storage.getCookies', 'params': {}, "id":10000})
await page.websocket.recv()
'{"id":10000,"result":{"cookies":[{"name":"__Secure-ENID","value":"20.SE=HEr4yp5mkjjVD6LhaMFh-6uWHs37ngjAevZ9WLDNznacxtTdy5G8W-ZNgUiYcYuwM9CkkMGjjoiDAKSPGXIg8PdQ7wMlR90fuhF1VWLdlH1x05SN6mr_qVYtgTJMkifBGO5A0U8sRouzGkJegGkcRIPwTjsszs03ulViKsjEIg6RvUxUymCLn-H5IVsMH2XDAQ",".....................................}'
looks like this breaks after regenerating cdp classes from the latest spec. Not 100% sure, but i will publish a rolledback + required commits version today
0.32 guys
0.32 guys
properly working again with 0.32. Thank you @ultrafunkamsterdam!
You're welcome!
Em seg., 8 de jul. de 2024 às 08:24, Danofun @.***> escreveu:
0.32 guys
properly working again with 0.32. Thank you @ultrafunkamsterdam https://github.com/ultrafunkamsterdam!
— Reply to this email directly, view it on GitHub https://github.com/ultrafunkamsterdam/undetected-chromedriver/issues/1816#issuecomment-2213927724, or unsubscribe https://github.com/notifications/unsubscribe-auth/AINH7L5LNKM5THFYIUT6KJDZLKAI7AVCNFSM6AAAAABFV4E4LSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJTHEZDONZSGQ . You are receiving this because you commented.Message ID: @.*** com>
Yeah it's working, thank you very much for the quick fix!
cookies = await page.send(cdp.storage.get_cookies())
stopped working from 0.32 to 0.34, it hangs for indefinite time.
Chromium Version 88.0.4291.0 (Developer Build) (x86_64)
MacOS 10.14.6
frame_data = await page.send(cdp.page.get_frame_tree())
current_url = frame_data.frame.url
current_url2 = await tab.evaluate("window.location.href")
print('current_url:', current_url)
print('current_url2:', current_url2)
cookies1 = await page.send(cdp.network.get_cookies([current_url ]))
print('cookies1', cookies1)
cookies2 = [{i.name: i.value for i in cookies1}]
cookies3 = [i.to_json() for i in cookies1]
with open('cookies.json', 'w') as f:
f.write(json.dumps(cookies2))
cookies = await tab.send(cdp.network.get_all_cookies()) print(cookies)
@pythonlw
# This does not hang, but only returns an empty array.
async def nodriver():
browser = await start(headless=False, lang="en-US")
page = await browser.get('https://www.google.com/ncr')
time.sleep(10)
cookies = await page.send(cdp.network.get_all_cookies())
print(cookies)
# This line of code hangs forever
cookies1 = await page.send(cdp.network.get_cookies([current_url]))
Posted in discussions as well, just posting here incase it helps someone
Hi, I've tried to find a way to let you know on the nodriver site, but issues / pull requests limited to collaborators only.
At the end of the set_all function there is the code
cookies = await connection.send(cdp.storage.get_cookies())
As the cookies are passed in as a parameter cookies, this wipes the cookies as passed in
Solutions:
Change the above to
await connection.send(cdp.storage.get_cookies())
although I don't know what it does, for me and how I need it, it works equally to just remove the line :-)
Hoping this will help someone