赞
踩
1.获取操作浏览器地址:
"C:\Program Files\Google\Chrome\Application\chrome.exe"
2.浏览器输入:chrome://version/,获取对应版本号
112.0.5615.50 (正式版本) (64 位) (cohort: Stable Installs & Version Pins)
3.下载驱动器版本
4.把驱动解压,获取驱动地址
5.0.特别注意点:运行前把执行的浏览器窗口全部关闭
5.0.窗口关闭
5.0.关闭
5.1.使用原来插件的运行cmd运行命令:
"C:\Program Files\Google\Chrome\Application\chrome.exe" --flag-switches-begin --flag-switches-end --remote-debugging-port=9226
5.2.使用新的环境,cmd命令
"C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9226 --user-data-dir="D:\user-chrome"
6.查看是否运行:
- # 查看所有进程
- tasklist |findstr chrome*
-
- # 查看进程的网络状态
- netstat -ano|findstr "9226"
7.直接上python命令
- # 下载浏览器对应版本的chromedriver.exe
- from selenium import webdriver
- from selenium.webdriver.chrome.options import Options
- from selenium.webdriver.chrome.service import Service
-
-
- def browser_now_05():
- # 启动115
- options_01 = Options()
- # chrome_options.add_experimental_option("debuggerAddress", "127.0.0.1:29887")
- # service_01 = Service = r"E:\down\chromedriver_win32_3_112.0.5615.49\chromedriver.exe"
- options_01.add_experimental_option("debuggerAddress", "127.0.0.1:9226")
- options_01.binary_location = r'C:\Users\用户名\AppData\Local\115Chrome\Application\115chrome.exe'
- # win32_2_83
- service_path = r"E:\down\chromedriver_win32_2_83.0.4103.39\chromedriver.exe"
- service_01 = Service(service_path)
- driver = webdriver.Chrome(service=service_01, options=options_01)
- driver.get('https://www.csdn.net/')
- # driver.get('https://baidu.com/')
- print(driver.title)
-
-
- if __name__ == "__main__":
- browser_now_05()

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。