'How to use Python selenium with pyvirtualdisplay on Ubuntu Server?

Is there any way to use Python selenium with pyvirtualdisplay on Ubuntu Server? I want to use extensions on chrome and keep this running on Ubuntu Server. I am using Undetected-Chromedriver.

I tried installing on Ubuntu Xvfb and other stuff apt-get update \ && apt-get install -y --no-install-recommends --no-install-suggests \ && apt-get install wget -y \ && apt-get install dpkg -y \ && apt install xvfb -y \ && apt-get install -y libglib2.0 gconf-service libasound2 libatk1.0-0 libcairo2 libcups2 libfontconfig1 libgconf-2-4 libgdk-pixbuf2.0-0 libgtk-3-0 libnspr4 libxss1 libnss3 xdg-utils libappindicator1 fonts-liberation

Also making this echo 'XVFB=/usr/bin/Xvfb\nXVFBARGS=":1 -screen 0 1920x1080x24 -ac +extension GLX +render -noreset"\nPIDFILE=/var/run/xvfb.pid\ncase "$1" in\n\tstart)\n\t\techo -n "Starting virtual X frame buffer: Xvfb"\n\t\tstart-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --background --exec $XVFB -- $XVFBARGS\n\t\techo "."\n\t\t;;\n\tstop)\n\t\techo -n "Stopping virtual X frame buffer: Xvfb"\n\t\tstart-stop-daemon --stop --quiet --pidfile $PIDFILE\n\t\techo "."\n\t\t;;\n\trestart)\n\t\t$0 stop\n\t\t$0 start\n\t\t;;\n\t*)\n\t\t\techo "Usage: /etc/init.d/xvfb {start|stop|restart}"\n\t\t\texit 1\nesac\n\nexit 0'
>> /etc/init.d/xvfb
&& chmod +x /etc/init.d/xvfb



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source