本文介绍了是否可以使用Google计算引擎运行Selenium脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在云端/在线/远程运行我的Selenium脚本.我被告知Google计算引擎可以允许这样做.

I would like to run my selenium scripts on the cloud/online/remotely. I have been advised google compute engine could allow this.

不胜感激,并且还需要采取其他措施,将不胜感激.

It would be appreciated if this could be confirmed and additional steps that will be needed to be given too.

建议使用其他任何解决方案.

Any other solutions suggested would be appreciated.

推荐答案

唯一的区别是您的GCE实例没有显示,这将成为浏览器的问题.

The only difference is that your GCE instance doesn't have a display, which is going to be an issue for your browser.

要解决此问题,您将要使用虚拟帧缓冲区"运行Selenium.这基本上是伪造的显示".

To address this, you'll want to run Selenium using a "Virtual Framebuffer". This is basically a "Fake display".

以下是在Ubuntu中设置虚拟帧缓冲区的方法:

Here's how you set a Virtual Framebuffer up in Ubuntu:

sudo apt-get install xvfb
sudo Xvfb :10 -ac

然后,在启动Selenium脚本之前,只需运行:

Then, before starting your selenium script, just run:

export DISPLAY=:10

这篇关于是否可以使用Google计算引擎运行Selenium脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 09:12