初始化webdriver
opts = webdriver.chrome.options.Options()
# 无头模式
opts.add_argument("--headless")
opts.add_argument("--disable-gpu")
# 驱动地址
driver_path = os.path.join(
os.path.dirname(__file__), "./driver/chromedriver.exe"
)
# 浏览器对象
browser = webdriver.Chrome(
service=webdriver.chrome.service.Service(driver_path), options=opts
)
# 隐示等待
browser.implicitly_wait(9)
标签:__,webdriver,Python,selenium,driver,argument,path,opts
From: https://www.cnblogs.com/congxinglong/p/17417124.html