用Python的selenium利用chrome的debugger模式操控浏览器
- wang
- 2024-02-28
- Python笔记
- 18浏览
- 0评论
1 cmd命令开启Chrome的debugger模式
C:\Users\Administrator\AppData\Local\Google\Chrome\Application>chrome.exe --remo
te-debugging-port=9222 --user-data-dir="D:\Desktop\item\chromtest\Chrome\Applica
tion\test"
2 Python代码接管浏览器,代码如下:
import time
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
options=Options()
options.add_experimental_option('debuggerAddress','127.0.0.1:9222')
bro=webdriver.Chrome(options=options)
time.sleep(3)
yuanma=bro.page_source
print(yuanma)
input=bro.find_element(By.ID,'search-input')
input.send_keys('ssss')
input.send_keys('招聘')
time.sleep(1)
bro.find_element(By.CLASS_NAME,'input-button').click()
time.sleep(3333)
本站文章除注明转载/出处外,均为本站原创或翻译。若要转载请务必注明出处,尊重他人劳动成果共创和谐网络环境。
转载请注明 : 文章转载自 » 纵马网 » Python笔记 » 用Python的selenium利用chrome的debugger模式操控浏览器
上一篇:视频拍摄流水线人员物料配置清单 (2024-02-28)
下一篇:Python的selenium利用Chrome的debugger模式采集小红书列表页 (2024-03-01)