We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi. I'm trying to google login, set cookies and load cookies. After loading I receive error: "Unable to set cookies" from seleniumbase import SB
with SB(uc=True) as sb: sb.open("https://accounts.google.com/v3/signin/identifier?continue=https%3A%2F%2Fmeet.google.com%3Fhs%3D193&ec=wgc-meet-globalnav-signin&ifkv=AXH0vVuW0awnt3jyg6ClWOc4AlEewXxz5NSbWuLxcIFhh-NNGonViU6kbcT_cmMsqMqcHN-rZpduzA<mpl=meet&flowName=GlifWebSignIn&flowEntry=ServiceLogin&dsh=S-1556410785%3A1742565796448358&hl=en-GB") sb.send_keys("input[type='email']", "[email protected]") sb.click("//*[contains(text(), 'Next')]") sb.send_keys("input[type='password']", "some_password!") sb.click("//*[contains(text(), 'Next')]") sb.save_cookies(name='cookies.txt') with SB(uc=True) as sb: sb.open("https://accounts.google.com/v3/signin/identifier?continue=https%3A%2F%2Fmeet.google.com%3Fhs%3D193&ec=wgc-meet-globalnav-signin&ifkv=AXH0vVuW0awnt3jyg6ClWOc4AlEewXxz5NSbWuLxcIFhh-NNGonViU6kbcT_cmMsqMqcHN-rZpduzA<mpl=meet&flowName=GlifWebSignIn&flowEntry=ServiceLogin&dsh=S-1556410785%3A1742565796448358&hl=en-GB") sb.load_cookies() sb.open("https://meet.google.com")
And the error:
Traceback (most recent call last): File "/path/to/pycharm/helpers/pydev/pydevd.py", line 1570, in _exec pydev_imports.execfile(file, globals, locals) # execute the script File "/path/to/pycharm/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "/home/user/my_project/sb.py", line 22, in <module> sb.load_cookies() File "/home/user/my_project/.venv/lib/python3.12/site-packages/seleniumbase/fixtures/base_case.py", line 4582, in load_cookies self.driver.add_cookie(cookie) File "/home/user/my_project/.venv/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 775, in add_cookie self.execute(Command.ADD_COOKIE, {"cookie": cookie_dict}) File "/home/user/my_project/.venv/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 429, in execute self.error_handler.check_response(response) File "/home/user/my_project/.venv/lib/python3.12/site-packages/selenium/webdriver/remote/errorhandler.py", line 232, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.UnableToSetCookieException: Message: unable to set cookie (Session info: chrome=134.0.6998.117) Stacktrace: #0 0x5ea2522aa8eb <unknown> #1 0x5ea251d02613 <unknown> #2 0x5ea251d10fd9 <unknown> #3 0x5ea251dc0fdf <unknown> #4 0x5ea251d82ef2 <unknown> #5 0x5ea251dad498 <unknown> #6 0x5ea251d82ca3 <unknown> #7 0x5ea251d4b736 <unknown> #8 0x5ea251d4c882 <unknown> #9 0x5ea25226bea0 <unknown> #10 0x5ea2522703c8 <unknown> #11 0x5ea2522516c1 <unknown> #12 0x5ea252270cc2 <unknown> #13 0x5ea25223580e <unknown> #14 0x5ea252296fb7 <unknown> #15 0x5ea252297207 <unknown> #16 0x5ea2522a9650 <unknown> #17 0x7ef4519d470a <unknown> #18 0x7ef451a58aac <unknown>
Would appreciate any help. Thank you in advance!
The text was updated successfully, but these errors were encountered:
Follow the working examples from:
Eg:
from seleniumbase import SB # Log in to Swag Labs and save cookies with SB(test=True, uc=True) as sb: sb.open("https://www.saucedemo.com") sb.wait_for_element("div.login_logo") sb.type("#user-name", "standard_user") sb.type("#password", "secret_sauce") sb.click('input[type="submit"]') sb.highlight("div.inventory_list", loops=6) sb.save_cookies(name="cookies.txt") # Load previously saved cookies to bypass login with SB(test=True, uc=True) as sb: sb.open("https://www.saucedemo.com") sb.load_cookies(name="cookies.txt") sb.open("https://www.saucedemo.com/inventory.html") sb.highlight("div.inventory_list", loops=12)
OR
import asyncio import time from seleniumbase import cdp_driver # Log in to Swag Labs and save cookies async def get_login_cookies(): url = "https://www.saucedemo.com" driver = await cdp_driver.start_async(incognito=True) page = await driver.get(url) element = await page.select("#user-name") await element.send_keys_async("standard_user") element = await page.select("#password") await element.send_keys_async("secret_sauce") element = await page.select('input[type="submit"]') await element.click_async() cookies = await driver.cookies.get_all() await page.close() return cookies # Load previously saved cookies to bypass login async def login_with_cookies(cookies): url_1 = "https://www.saucedemo.com" url_2 = "https://www.saucedemo.com/inventory.html" driver = await cdp_driver.start_async() page = await driver.get(url_1) await driver.cookies.set_all(cookies) await driver.get(url_2) await page.select("div.inventory_list") time.sleep(2) if __name__ == "__main__": loop = asyncio.new_event_loop() cookies = loop.run_until_complete(get_login_cookies()) loop.run_until_complete(login_with_cookies(cookies))
Sorry, something went wrong.
No branches or pull requests
Hi. I'm trying to google login, set cookies and load cookies. After loading I receive error: "Unable to set cookies"
from seleniumbase import SB
And the error:
Would appreciate any help. Thank you in advance!
The text was updated successfully, but these errors were encountered: