【问题标题】:Unable to run selenium application using the Chrome driver on a server无法在服务器上使用 Chrome 驱动程序运行 selenium 应用程序
【发布时间】:2017-03-12 21:03:20
【问题描述】:

我在 Ubuntu 的服务器上安装了最新版本的 Chrome 驱动程序 2.9,但没有显示。我已经设置了其他所有内容。当我运行我的 python 脚本时,我得到了这个:

raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"3104.1","isDefault":true},"id":1,"name":"","origin":"://"}
  (Session info: chrome=54.0.2840.71)
  (Driver info: chromedriver=2.9.248304,platform=Linux 4.4.0-38-generic x86_64)

如何解决这个问题?

【问题讨论】:

    标签: python linux google-chrome selenium ubuntu


    【解决方案1】:

    一般来说,你不能在没有显示的情况下用普通的 FF 或 Chrome 运行 Selenium。

    据我所知,您有以下选择:

    • 在您的服务器上创建虚拟显示器。您正在寻找的是VNC server。您可以查看例如 this 教程。有了这个,您可以设置服务器上的虚拟显示器数量,并在其中使用 selenium 运行实际浏览器。
    • 使用无头浏览器(不需要显示)。我知道经常使用PhantomJS。但似乎 Chrome 会去support this soon。你可以找到很多关于这个主题的指南on the google

    【讨论】:

    • 你的问题不清楚。请提供更多信息。您是说您使用的是不带显示屏的 Chrome - 目前还不可能。
    • 我没这么说。
    • 您说with no display. 并没有提供您如何解决此问题的任何其他信息。当您只抛出一条错误消息时,很难调试问题。您的浏览器是否完全启动? ....
    猜你喜欢
    • 2014-04-03
    • 2014-03-23
    • 1970-01-01
    • 2015-11-01
    • 1970-01-01
    • 1970-01-01
    • 2019-11-22
    • 2018-04-16
    • 2018-10-11
    相关资源
    最近更新 更多