Skip to content

Selenium webdriver ignores virtualdisplay under MacOS #99

Description

@reisenmachtfreude

I'm running MacOs 15.3.1 with Python 3.9.6 and Quartz. If I execute the following code, the Firefox browser window shows on the normal screen and not in the virtual screen. In general the virtual screen exists as it is listed (ps -ef | grep Xvfb).

    import time
    from pyvirtualdisplay import Display
    from selenium import webdriver
    
    display = Display(visible=0, size=(800, 600))
    display.start()
    
    # now Firefox will run in a virtual display.
    # you will not see the browser.
    browser = webdriver.Firefox()
    browser.get('http://www.google.com')
    time.sleep(30)
    browser.quit()
    display.stop()

However, this works fine, The message box is opened in the virutal screen.

from easyprocess import EasyProcess

from pyvirtualdisplay import Display
 with Display(backend="xvfb") as disp:
     with EasyProcess(["xmessage", "hello"]) as proc:
         proc.wait()

Is there anything I can do?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions