hi i have an problem im new to xlib with python im trying to launch browser instance inside of vd err lies in that vd is successfully launched and browser instance is successfully launched but not inside of vd i guess im implemented it wrong i tried to add err handling but nothing seams to break ########### class for launching vd class DisplayWindow: def __init__(self, width, height, title): self.display = Xlib.display.Display() self.screen = self.display.screen() # Create window attributes manually self.attributes = { "background_pixel": self.screen.white_pixel, "event_mask": Xlib.X.ExposureMask | Xlib.X.ButtonPressMask, "border_width": 10, "depth": self.screen.root_depth, "class": Xlib.X.InputOutput, "visual": Xlib.X.CopyFromParent } self.window = self.create_window(width, height) self.set_window_title(title) def create_window(self, width, height): return self.screen.root.create_window( 0, 0, # x, y coordinates width, height, # width, height **self.attributes # Use dictionary unpacking for attributes ) def set_window_title(self, title): self.window.set_wm_name(title) def launch_display(self): self.window.map() self.display.sync() print(f"Display ID ---->{ self.display.get_display_name()}") async def drag_and_drop(self, x1, y1, x2, y2): self.window.warp_pointer(x1, y1) self.display.sync() # Simulate left mouse button press fake_input(self.display, Xlib.X.ButtonPress, 1) self.display.sync() # Move the mouse pointer to the ending coordinates self.window.warp_pointer(x2, y2) self.display.sync() # Simulate left mouse button release fake_input(self.display, Xlib.X.ButtonRelease, 1) self.display.sync() this is my implementation of this display_window.launch_display() os.environ['DISPLAY'] = ':0' def is_display_available(display_id): try: display = Xlib.display.Display(display_id) return True except Xlib.error.DisplayConnectionError: return False if not is_display_available(':0'): print("Virtual display is not available") exit(1) options = webdriver.ChromeOptions() #options.headless = True options.add_argument('--display=:0') options.add_argument("--window-size=945,1028") options.add_experimental_option("prefs", {"general.enable_javascript": True}) async with webdriver.Chrome(options=options) as driver: pointer = driver.current_pointer #await driver.execute_cdp_cmd("Network.setExtraHTTPHeaders", {"headers": headers}) tasks = [initialize( proxy, pointer, driver) for _ in range(1)] for task in tasks: await task i tryied rewriting code 3 times working with other vd lib but there not suitable for the task Continue reading...