[selenium] chrome driver 팝업 비허용

2024. 8. 29. 17:18개발/Python

def chrome_driver_dev():
    options = webdriver.ChromeOptions()
    # options.add_argument('--headless')
    # options.add_argument('--no-sandbox')
    # options.add_argument("--start-maximized")
    options.add_argument('--disable-dev-shm-usage')
    options.add_argument("--disable-notifications")
    options.add_experimental_option('excludeSwitches', ['disable-popup-blocking'])

    service = Service('/opt/homebrew/bin/chromedriver')

    return webdriver.Chrome(service=service, options=options)