In a multi-monitor display environment, how do I tell Selenium which display to open a new window in?

后端 未结 17 2225
小蘑菇
小蘑菇 2021-01-31 15:53

Sorry if this has been asked and answered. I did a search but came up empty.

17条回答
  •  深忆病人
    2021-01-31 16:49

    I have noticed that by setting these things below, my browser gets opened alway in the same monitor (I have two monitors the eDP and a secondary HDMI monitor). Maybe it has to do with the position:

    # console log
    d = desired_capabilities.DesiredCapabilities.CHROME
    d['loggingPrefs'] = { 'browser':'ALL' }
    
    # Driver
    self.driver = webdriver.Chrome(desired_capabilities=d)
    self.driver.implicitly_wait(5) # seconds
    self.driver.set_window_size(800, 800)
    self.driver.set_window_position(0, 0)
    

提交回复
热议问题