selenium.common.exceptions。WebDriverException:消息:未知错误:Chrome无法启动,但几周前代码工作正常

。
订阅者
271
文章
0
粉丝
测试交流1 307字数 555阅读1分51秒阅读模式
摘要请帮忙 因此,我有这个脚本来访问我的互联网调制解调器并重新启动设备,但几周前停止工作,下面是我的代码: 从selenium导入webdriver 来自selenium.webdri...

请帮忙

因此,我有这个脚本来访问我的互联网调制解调器并重新启动设备,但几周前停止工作,下面是我的代码:文章源自玩技e族-https://www.playezu.com/193185.html

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
service = Service(executable_path=ChromeDriverManager().install())
driver = webdriver.Chrome(service=service)
from selenium.webdriver.common.by import By
chrome_options = Options()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')
driver = webdriver.Chrome(ChromeDriverManager().install(),options=chrome_options)
driver.get('http://192.168.15.1/me_configuracao_avancada.asp',)
user = driver.find_element(By.ID, "txtUser")
user.send_keys("support")
btnLogin = driver.find_element(By.ID, "btnLogin")
btnLogin.click()
driver.get('http://192.168.15.1/reboot.asp',)
reboot = driver.find_element(By.ID, "btnReboot")
reboot.click()
print("Modem Reiniciado!")

现在,当我运行时,返回以下错误消息:文章源自玩技e族-https://www.playezu.com/193185.html

/usr/lib/python3/dist-packages/requests/__init__.py:89: RequestsDependencyWarning: urllib3 (1.26.11) or chardet (3.0.4) doesn't match a supported version!
  warnings.warn("urllib3 ({}) or chardet ({}) doesn't match a supported "
Traceback (most recent call last):
  File "modem.py", line 7, in <module>
    driver = webdriver.Chrome(service=service)
  File "/home/fabio/.local/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
    super().__init__(DesiredCapabilities.CHROME['browserName'], "goog",
  File "/home/fabio/.local/lib/python3.8/site-packages/selenium/webdriver/chromium/webdriver.py", line 92, in __init__
    super().__init__(
  File "/home/fabio/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 277, in __init__
    self.start_session(capabilities, browser_profile)
  File "/home/fabio/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 370, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/home/fabio/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 435, in execute
    self.error_handler.check_response(response)
  File "/home/fabio/.local/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 247, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally.
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Stacktrace:
#0 0x561e346d9cd3 <unknown>
#1 0x561e344e1968 <unknown>
#2 0x561e3450625c <unknown>
#3 0x561e345018fa <unknown>
#4 0x561e3453c94a <unknown>
#5 0x561e34536aa3 <unknown>
#6 0x561e3450c3fa <unknown>
#7 0x561e3450d555 <unknown>
#8 0x561e347212bd <unknown>
#9 0x561e34725418 <unknown>
#10 0x561e3470b36e <unknown>
#11 0x561e34726078 <unknown>
#12 0x561e346ffbb0 <unknown>
#13 0x561e34742d58 <unknown>
#14 0x561e34742ed8 <unknown>
#15 0x561e3475ccfd <unknown>
#16 0x7fc22f8b9609 <unknown>

几周前,这段代码运行没有任何问题,但现在我被卡住了
我用的是谷歌Chrome 103.0.5060.134和ChromeDriver 103.0.5060.34。文章源自玩技e族-https://www.playezu.com/193185.html

软件功能测试评价文章源自玩技e族-https://www.playezu.com/193185.html 文章源自玩技e族-https://www.playezu.com/193185.html

 
    • undetected Selenium
      undetected Selenium 9

      似乎是你的 请求 模块已回溯,需要更新,您可以使用以下任一命令:
      pip3 install 请求


      pip3 install –upgrade 请求

    匿名

    发表评论

    匿名网友
    确定

    拖动滑块以完成验证