📜  python webdriver open with chrome extension - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:01.226000             🧑  作者: Mango

代码示例1
import os
from selenium import webdriver
from selenium.webdriver.chrome.options import Options


executable_path = "path_to_webdriver"
os.environ["webdriver.chrome.driver"] = executable_path

chrome_options = Options()
chrome_options.add_extension('path_to_extension')

driver = webdriver.Chrome(executable_path=executable_path, chrome_options=chrome_options)
driver.get("http://stackoverflow.com")
driver.quit()