pyvirtualdisplay, cannot open host display

Viewed 106

I am trying to run python script

from selenium import webdriver
from pyvirtualdisplay import Display

Display(visible=1, size=(800, 600)).start()

driver = webdriver.Chrome(options=option)
driver.get("https://google.com")

but I am getting error "Xephyr cannot open host display. Is DISPLAY set? It's minimal ubuntu 18.04 installation with x11 installed

also chromium-browser works only when I type startx chromium-browser, otherwise it's drop Trace/breakpoint trap (core dumped)

@update when I run sudo xinit and run my script manually it works but in window, not fullscreen, are there another way to run it?

@update I was trying to set options in python script to run fullscreen like "--start-fullscreen" and "--start-maximized" but it cover half of screen like here: https://unix.stackexchange.com/questions/273989/how-can-i-make-chromium-start-full-screen-under-x also I was trying to edit Preferences for chromium like in this thread in /home//.config/chromium/Default/Preferences, but its not working, I saw that every run of my python script chromium generate new Preferences in /tmp/.org.chromium.Chromium./Default/Preferences this browser setting are different than these in /home//.config/(...)/Preferences ofc I have delete Display option from python script Any help?

0 Answers
Related