Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to run selenium scripts using google compute engine?

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.

like image 685
user2985043 Avatar asked Jan 11 '23 21:01

user2985043


1 Answers

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

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

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

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

Then, before starting your selenium script, just run:

export DISPLAY=:10
like image 102
Thomas Orozco Avatar answered May 19 '23 11:05

Thomas Orozco