偶尔要用到,start writing
实现步骤
- 先启动
Chrome
,打开任务管理器
,找到chrome.exe
,地址栏输入cmd
,然后执行chrome.exe --remote-debugging-port=12345

- 看 !!!
12345
端口开了没netstat -aon | findstr "12345"


- 开了,你就连呗 ~ 开始指挥你的浏览器 ~~~ 往左走,往右走
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
if __name__ == '__main__':
chrome_options = Options()
chrome_options.add_experimental_option("debuggerAddress", "127.0.0.1:12345")
driver = webdriver.Chrome(options=chrome_options)
driver.get("https://www.selenium.dev/")
print(driver.title)
driver.quit()

Talk is cheap, show me huajianketang's code. 😄
网友评论