找回密码
 立即注册
查看: 39|回复: 0

selenium 调用已打开谷歌浏览器

[复制链接]

24

主题

20

回帖

140

积分

管理员

积分
140
发表于 2024-4-3 23:05:43 | 显示全部楼层 |阅读模式
1.启动chrome
  1. "C:\Program Files\Google\Chrome\Application\chrome.exe"  --remote-debugging-port=9527
复制代码


2.执行test.py
  1. from selenium import webdriver
  2. from selenium.webdriver.chrome.options import Options
  3. from time import sleep
  4. from selenium.webdriver.common.by import By

  5. options = Options()
  6. options.add_experimental_option("debuggerAddress", "127.0.0.1:9527")
  7. bro = webdriver.Chrome(options=options)

  8. url = 'https://xh.newrank.cn/content/notes/notesSearch'
  9. bro.get(url)

  10. print(bro.title)
复制代码



您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|上海录客智能科技 ( 沪ICP备17017717号-8 )|网站地图

GMT+8, 2024-5-10 23:17 , Processed in 0.195779 second(s), 34 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表