The Selenium documentation mentions that the Chrome webdriver can take an instance of ChromeOptions
, but I can't figure out how to create ChromeOptions
.
I'm hoping to pass the --disable-extensions
flag to Chrome.
Create an object of DesiredCapabilities Chrome class and merge the Desired Capabilities class object with Chrome Options class object using merge method. Create an object of Chrome Driver class and pass the Chrome Options Selenium object as an argument.
Found the chrome Options class in the Selenium source code.
Usage to create a Chrome driver instance:
from selenium import webdriver from selenium.webdriver.chrome.options import Options chrome_options = Options() chrome_options.add_argument("--disable-extensions") driver = webdriver.Chrome(chrome_options=chrome_options)
This is how I did it.
from selenium import webdriver chrome_options = webdriver.ChromeOptions() chrome_options.add_argument('--disable-extensions') chrome = webdriver.Chrome(chrome_options=chrome_options)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With