umihico / docker-selenium-lambda

The simplest demo of chrome automation by python and selenium in AWS Lambda
MIT License
504 stars 119 forks source link

which chrome_options is essential? #186

Closed mistlet0e closed 11 months ago

mistlet0e commented 11 months ago

I was trying to debug an issue when I can access outer element after finding shadow root locally but not on container. I was thinking it might be due to the chrome options configuration. May I know which chrome options are essential for building the docker and why was that? Thanks in advance

umihico commented 11 months ago

@mistlet0e To be honest, I don't remember so much. Please try to deploy without some options, and tell me if it works without them These comment is what I think so far

    # maybe essential
    options.add_argument('--headless')
    # maybe essential
    options.add_argument('--no-sandbox')
    # maybe essential
    options.add_argument("--disable-gpu")
    # maybe optional
    options.add_argument("--window-size=1280x1696")
    # maybe essential
    options.add_argument("--single-process")
    # maybe essential
    options.add_argument("--disable-dev-shm-usage")
    # maybe optional
    options.add_argument("--disable-dev-tools")
    # maybe essential
    options.add_argument("--no-zygote")
    # essential
    options.add_argument(f"--user-data-dir={mkdtemp()}")
    # essential
    options.add_argument(f"--data-path={mkdtemp()}")
    # essential
    options.add_argument(f"--disk-cache-dir={mkdtemp()}")
    # maybe optional
    options.add_argument("--remote-debugging-port=9222")