From f82f65084b77d2e8f9e8be323fedf169270a9824 Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Fri, 6 May 2022 13:41:19 +0200 Subject: Selenium: Do not use pyvirtualdisplay, set Firefox to headless --- selenium_eduvpn.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/selenium_eduvpn.py b/selenium_eduvpn.py index 65c5104..6c91fa5 100644 --- a/selenium_eduvpn.py +++ b/selenium_eduvpn.py @@ -2,7 +2,7 @@ import os import sys from selenium import webdriver from selenium.webdriver.common.keys import Keys -from pyvirtualdisplay import Display +from selenium.webdriver.firefox.options import Options # Logs in to the default vpn user portal with selenium @@ -51,12 +51,11 @@ if __name__ == "__main__": print("Error: no auth url specified") sys.exit(1) - # Start a virtual display using xvfb - disp = Display() - disp.start() + options = Options() + options.headless = True # Use the firefox driver - driver = webdriver.Firefox() + driver = webdriver.Firefox(options=options) # Login to the portal authURL = sys.argv[1] @@ -64,4 +63,3 @@ if __name__ == "__main__": # Cleanup driver.close() - disp.stop() -- cgit v1.2.3