I created a selenium browser over SSH using like so
from pyvirtualdisplay import Display
display = Display(visible=0, size=(1920, 1920))
display.start()
driver = webdriver.Chrome()
I then logged into the machine with VNC. And my goal is to move the chrome window created there onto my VNC session. However that instance of chrome doesn't even show up in the task bar even though I can tell it is open and even interact with it.
I connected via
webdriver.Remote(command_executor=bla,options=options)
And I did try
driver.switch_to.window(driver.current_window_handle)
But that didn't work. I even tried
driver.switch_to.window(webdriver.Chrome().current_window_handle)
But this gave me a selenium.common.exceptions.NoSuchWindowException
by default, manage_global_env is True
so
pyvirtualdisplay.Display()will set
os.environ["DISPLAY"]to the virtual displaywebdriver will use
subprocess.Popenwith the environment
os.environto start chromeso this should just work...