Selenium ChromeBrowser get()方法不起作用

时间:2018-03-27 18:01:12

标签: python selenium selenium-webdriver python-3.6

启动程序后,它会自动引发此错误。知道怎么解决吗?

Traceback (most recent call last):
  File "C:/Users/StyleZ/PycharmProjects/SpamBot/AddToGroup.py", line 13, in <module>
    browser.get(base_url)
  File "C:\Users\StyleZ\PycharmProjects\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 324, in get
    self.execute(Command.GET, {'url': url})
  File "C:\Users\StyleZ\PycharmProjects\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 312, in execute
    self.error_handler.check_response(response)
  File "C:\Users\StyleZ\PycharmProjects\venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: unhandled inspector error: {"code":-32000,"message":"Cannot navigate to invalid URL"}
  (Session info: chrome=65.0.3325.181)
  (Driver info: chromedriver=2.32.498550 (9dec58e66c31bcc53a9ce3c7226f0c1c5810906a),platform=Windows NT 10.0.10586 x86_64)*

1 个答案:

答案 0 :(得分:2)

在您发布的堆栈跟踪中,&#34;无法导航到无效的网址&#34; ,因此请确保您将有效的网址传递给 get()

selenium.common.exceptions.WebDriverException: Message: unknown error: unhandled inspector error: {"code":-32000,"message":"Cannot navigate to invalid URL"}
  (Session info: chrome=65.0.3325.181)