본문 바로가기

개발/Python

[selenium] chrome driver 팝업 비허용

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)