Python Forum

Full Version: Really confused by Selenium Grid2, please help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I am trying to run a lot (10+) of headless Selenium instances all at once (in parallel). For example, I would like to visit a website and click on a button and then print the cookies from that website for every instance I open. Something like this:

    from selenium import webdriver
    from selenium.webdriver.chrome.options import Options

    options = Options()
    options.add_argument('--headless')
    options.add_argument("--start-maximized")
    driver = webdriver.Chrome(chrome_options=options, executable_path=".../chromedriver.exe")
    driver.get("https://www.google.co.uk/")
    driver.find_element_by_link_text("Privacy").click()

    cookies_list = driver.get_cookies()
    cookies_dict = {}
    for cookie in cookies_list:
        cookies_dict[cookie['name']] = cookie['value']

    print(cookies_dict)

    driver.quit()
I've spent about 4-5 hours trying to do this and nothing has worked. Every single tutorial I've visited is either useless, not Windows 10 or both. I've always hit an error along the way despite following their directions exactly, and the errors are often very odd (sorry for being vague).

Can anyone please explain to me how I can run a lot of these all at once using Selenium Grid2 or something else?

Thanks!