Question

I'm having trouble with virtual monitor when running a droplet with python running google chrome

I’m trying to run google chrome with python and it’s not giving me any errors. I am trying to understand how to use the virtual monitor but it’s of no use.

ubuntu 20.04, python 3.12 tried xvfb-run


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
December 3, 2024

Hi Ibrahim,

Would you mind sharing the exact error messages you’re encountering?

Also, if possible, could you share a snippet of the code you’re running and the command you’re using with xvfb-run? That will help pinpoint the issue better!

- Bobby

KFSys
Site Moderator
Site Moderator badge
December 4, 2024

To run Google Chrome with Python in a virtual monitor environment like Xvfb on Ubuntu 20.04, the most common issue arises from the configuration of the virtual frame buffer however, I might be mistaken. Can you share a bit more about your setup so that we can provide you with a better pinpoint answer?

alexdo
Site Moderator
Site Moderator badge
December 4, 2024

Heya,

You can ensure that you run the script with xvfb-run:

xvfb-run python3 chrome_xvfb.py

Also the chromedriver must match the version of Google Chrome. As alternative you can use a different virtual display manager like VNC (x11vnc) to see what the virtual screen is rendering.

Regards

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.