diegoparrilla / headless-chrome-aws-lambda-layer

Headless Chrome prepared to run as a layer in AWS lambda with Python >=3.8 and Amazon Linux 2
Apache License 2.0
72 stars 15 forks source link

Undetected Chromedriver #6

Open ottogutierrez opened 1 year ago

ottogutierrez commented 1 year ago

Thank you so much for this! I am currently getting tracked by a website I need to scrape, and was wondering if there's any plans for implementing this library with undetected-chromedriver

diegoparrilla commented 1 year ago

Hi Otto!

I have used this project with undetected-chromedriver driver successfully. You only need to write in your lambda your own src/headless_chrome.py importing the undetected-chromedriver libraries instead of the selenium libraries:

Instead of importing:

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

I would try with:

import undetected_chromedriver as uc

And modify the create_driver function with something to create the undetected-chromedriver wrapper:

 options = uc.ChromeOptions()
    options.headless = True
    options.add_argument("--headless")
    chrome = driver = uc.Chrome(options=options)

I made it work a couple of years ago with the version v1. I will have to check where I left the fully functional code.

Good luck!