python - selenium.common.exceptions.WebDriverException : Message: Error loading page for the Firefox SSL

标签 python selenium ssl

from selenium import webdriver

capabilities = webdriver.DesiredCapabilities().FIREFOX
capabilities['acceptSslCerts'] = False
driver = webdriver.Firefox(capabilities=capabilities)
driver.get('https://cacert.org/')
driver.quit()

我尝试了上面的脚本来处理 SSL,但是我得到了错误:

C:\Python27\python.exe "C:/Users/alokv/AppData/Roaming/JetBrains/PyCharm Community Edition 2016.3.2/jre/jre/bin/NIOS_UI_Automation/test_log.py"

Traceback (most recent call last):

  File "C:/Users/alokv/AppData/Roaming/JetBrains/PyCharm Community Edition 2016.3.2/jre/jre/bin/NIOS_UI_Automation/test_log.py", line 13, in <module>
    driver.get('https://cacert.org/')
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 248, in get
    self.execute(Command.GET, {'url': url})
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 236, in execute
    self.error_handler.check_response(response)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 192, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Error loading page

谁能帮我解释一下为什么会这样?

最佳答案

我运行了您的代码,运行良好。我几乎可以肯定您的问题是网站从未加载可能是由于网速慢。您可以在 driver.title 中插入 assert "CAcert.org" 以确保在继续下一步之前页面已加载。

关于python - selenium.common.exceptions.WebDriverException : Message: Error loading page for the Firefox SSL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42380378/

相关文章:

java - 使用selenium上传文件javascript错误

java - 访问 Gmail(或安全网站)而不会出现 PKIX 证书路径错误

JBoss 的 SSL 证书导入和配置

python - 分配 a,b = c,a 与 b,a = a,c 相同吗?

ios - 如何以编程方式在 Safari 中启用 "Allow Remote Automation"

javascript - Selenium 可以用于测试单页 JavaScript 应用程序吗?

ssl - 使用 PHP 为 PayPal 生成 .pem 证书

Python特定的PATH环境变量?

java - Python 相当于 Java 的 Set.add()?

python - gspread 给出 TypeError : expected bytes when trying to log in