Answers for "webdriver.ChromeOptions()"

1

webdriver.ChromeOptions()

from selenium import webdriver

opt = webdriver.ChromeOptions()
opt.add_argument("--disable-infobars")
opt.add_argument("start-maximized")
opt.add_argument("--disable-extensions")
opt.add_argument("--start-maximized")
opt.add_argument("no-sandbox")
opt.add_argument("--disable-gpu")
opt.add_argument("--disable-dev-shm-usage")
opt.add_argument("--incognito")
opt.add_argument("--headless")
opt.add_argument("--disable-xss-auditor")
opt.add_argument("--disable-web-security")
opt.add_argument("--allow-running-insecure-content")
opt.add_argument("--disable-setuid-sandbox")
opt.add_argument("--disable-webgl")
opt.add_argument("--disable-popup-blocking")
# Pass the argument 1 to allow and 2 to block
opt.add_experimental_option("prefs", {
    "profile.default_content_setting_values.media_stream_mic": 2,
    "profile.default_content_setting_values.media_stream_camera": 2,
    "profile.default_content_setting_values.geolocation": 2,
    "profile.default_content_setting_values.notifications": 2
})
driver = webdriver.Chrome(chromepath, chrome_options=opt)
driver.get(url)

# https://selenium-python.readthedocs.io/api.html
Posted by: Guest on December-29-2020
0

webdriver.ChromeOptions()

opt.add_argument("--disable-infobars")
Posted by: Guest on August-30-2021

Python Answers by Framework

Browse Popular Code Answers by Language