• window10系统,先cmd打开chrome,

    chrome --remote-debugging-port=9222
  • 执行脚本
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By def test_adduser():
options=Options()
options.add_experimental_option('debuggerAddress', '127.0.0.1:9222')
driver=webdriver.Chrome(options=options)
driver.implicitly_wait(5)
driver.find_element(By.CSS_SELECTOR,'.js_service_list a:nth-child(1) .index_service_cnt_item_title').click()
  • 报错
>       raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.WebDriverException: Message: unknown error: cannot connect to chrome at 127.0.0.1:9222
E from chrome not reachable ..\venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py:242: WebDriverException
  • 发现打开调试浏览器一段时间后,就会连不上,这是需要关闭浏览器,重新执行chrome --remote-debugging-port=9222
  • 再不行,重启电脑,问题解决

最新文章

  1. HTML+CSS中的一些小知识
  2. sql脚本多服务器操作
  3. NSoperation用法详解及与GCD的比较
  4. A+B问题 涉及EOF
  5. 菜鸟学习Hibernate——持久层框架
  6. python在linux制作图形界面(snack)
  7. SRM566 1000pts
  8. 利用java反射机制对方法进行调用
  9. 让rdlc报表在ReportViewer中水平居中的方法
  10. json中头疼的null
  11. nginx+lua安装配置
  12. 【NOIP2015】字串
  13. 【BZOJ1934】善意的投票(网络流)
  14. netty和protobuf的使用
  15. 基于ROS的分布式机器人远程控制平台
  16. 图灵机器人API接口
  17. 前端UI框架总结
  18. Spark多种运行模式
  19. 使用spring validation完成数据后端校验
  20. js 正则表达式验证密码、邮箱格式.....

热门文章

  1. MySQL05
  2. 【Azure 应用服务】App Service .NET Core项目在Program.cs中自定义添加的logger.LogInformation,部署到App Service上后日志不显示Log Stream中的问题
  3. NOIP 模拟 $32\; \rm Walker$
  4. NOIP 模拟 $12\; \text{简单的区间}$
  5. 题解 y
  6. 【开发工具】idea常用配置
  7. win10 安装mysql5.7 【自定义安装路径】
  8. (二)js基础。。。freecodecamp笔记
  9. 一、web请求
  10. 学习Java的9张思维导图