zoukankan      html  css  js  c++  java
  • cannot connect to chrome at 127.0.0.1:9222

    • 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
    
    ..venvlibsite-packagesseleniumwebdriver
    emoteerrorhandler.py:242: WebDriverException
    
    • 发现打开调试浏览器一段时间后,就会连不上,这是需要关闭浏览器,重新执行chrome --remote-debugging-port=9222
    • 再不行,重启电脑,问题解决
  • 相关阅读:
    P6007 [USACO20JAN]Springboards G
    CF1000F One Occurrence
    P6100 [USACO19FEB]Painting the Barn G
    P5838 [USACO19DEC]Milk Visits G
    P4085 [USACO17DEC]Haybale Feast
    P4267 [USACO18FEB]Taming the Herd
    P1712 [NOI2016]区间
    CF786B Legacy
    P5665 划分
    NOI2020网上同步赛 游记
  • 原文地址:https://www.cnblogs.com/Uni-Hoang/p/13125108.html
Copyright © 2011-2022 走看看