ultrafunkamsterdam / undetected-chromedriver

Custom Selenium Chromedriver | Zero-Config | Passes ALL bot mitigation systems (like Distil / Imperva/ Datadadome / CloudFlare IUAM)
https://github.com/UltrafunkAmsterdam/undetected-chromedriver
GNU General Public License v3.0
9.68k stars 1.14k forks source link

[nodriver] support how to set cookies? #1909

Open gouravkumar99 opened 3 months ago

gouravkumar99 commented 3 months ago

`value = "voULhnQT1BNNeq7cD85MFBlwZegqOaciqbSy~bL_7A9Yg3UZsX4XZFQX2xDHTMbLSoiOf8rc4hr6~pSpreX_RrJq7LR13WfXBLslp8sjgnMHfNkLbgqzeCdh5QgKEREd" cookie = { 'name': 'datadome', 'value': value, 'domain': '.uefa.com', 'path': '/', 'expires': cookie.expires,
'httpOnly': False, 'secure': True, 'sameSite': 'Lax' }

    with open(f'.session{self.botid}.dat', 'w') as f:
        json.dump(cookie, f)

    await self.tab.send(cdp.storage.set_cookies(cookies=[cookie]))
    await self.browser.cookies.set_all(cookies=[cookie])
    await self.browser.cookies.save(file=f'.session{self.botid}.dat')
    await self.browser.cookies.load(file=f'.session{self.botid}.dat')`

I tried all these methods but cookies are not getting set.

max32002 commented 3 months ago

you need remark this line: https://github.com/ultrafunkamsterdam/nodriver/compare/main...max32002:nodriver:main