【问题标题】:How to start headless browser with Selenium on Ubuntu using bash or Python如何使用 bash 或 Python 在 Ubuntu 上使用 Selenium 启动无头浏览器
【发布时间】:2016-02-18 19:32:47
【问题描述】:

我正在运行一个使用 Selenium 的 Python 脚本的 cron 作业。 Selenium 需要显示器,所以我有 installed Xvfb, started the display, and firefox:

sudo Xvfb :10 -ac
export DISPLAY=:10
firefox

这在我在控制台中运行这些命令时有效,但我希望能够使用 cron 来完成。我怎样才能做到这一点?如果我以主用户身份运行虚拟显示器,他们是否可以在 Python 脚本/Selenium 需要时访问虚拟显示器?

【问题讨论】:

    标签: python bash ubuntu selenium cron


    【解决方案1】:

    我建议你使用 selenium Ghost 驱动程序(它正在运行 PhantomJS)。

    【讨论】:

      猜你喜欢
      • 2020-10-18
      • 2018-10-31
      • 1970-01-01
      • 1970-01-01
      • 2020-04-23
      • 1970-01-01
      • 1970-01-01
      • 2012-04-10
      • 2021-05-16
      相关资源
      最近更新 更多