1。安装seleniumpipinstallseleniumWindowspip3installseleniumMac2。下载浏览器驱动 下载地址:https:chromedriver。chromium。orgdownloads 注意浏览器版本 将下载好的chromedriverwin32。zip解压得到一个chromedriver。exe文件,将其复制到你的Python程序执行路径。 3。启动Chrome浏览器的调试模式找到Chrome浏览器安装位置 执行以下命令chrome。exeremotedebuggingport9222 4。示例代码fromseleniumimportwebdriverfromselenium。webdriver。chrome。optionsimportOptions配置Options()配置。debuggeraddresslocalhost:9222驱动位置。Datachromedriver。exe我是把chromedriver驱动放在项目根目录下浏览器webdriver。Chrome(驱动位置,chromeoptions配置)print(浏览器。title)