You need root for this. You need to install Xvfb for screen and you need to enable screen using "Xvfb :1 -screen 1 1600x1200x16 &" command where ":1" will be ID of the screen that will be input in the script on foolowing line: "os.environ['DISPLAY'] = ':1'"
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import time
from pyvirtualdisplay import Display
import os
os.environ['DISPLAY'] = ':1'
display = Display(visible=0, size=(800, 600))
display.start()
chrome_options = Options()
chrome_options.add_argument('--no-sandbox') #bypass OS security model
chrome_options.add_argument("disable-infobars");
chrome_options.add_experimental_option("excludeSwitches", ["enable-automation"])
chrome_options.add_experimental_option('useAutomationExtension', False)
driver = webdriver.Chrome(executable_path='/root/chromedriver', chrome_options=chrome_options)
time.sleep(3)
driver.get("https://ipinfo.io/json")
driver.maximize_window()
os.system('import -window root screenshot.png')
driver.close()
Output will be screenshot.png with full chrome browser. Happy screenshooting!