from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import time
import random
options = Options()
options.binary_location = "./chrome/chrome.exe"
options.add_argument('–-incognito')
options.add_argument('--disable-infobars')
options.add_argument('--start-maximized')
driver = webdriver.Chrome(chrome_options=options,executable_path="./chrome/chromedriver.exe")
driver.get("https://www.baidu.com")
`selenium` 自定义浏览器路径和驱动路径
最新推荐文章于 2025-10-17 15:02:14 发布
本文介绍了一种使用Selenium库自动化操作Chrome浏览器的方法。通过设置Chrome选项,如隐私模式、禁用信息栏和最大化窗口,以及指定Chrome和Chromedriver路径,可以实现对网页的自动化访问。示例中演示了打开百度网站的过程。
471

被折叠的 条评论
为什么被折叠?



