Start Chrome headless with a fixed window size (Python)
QuizEasy-MediumPython onlyAsked in: Capgemini, Cognizant, Infosys, Wipro
Which code starts Chrome without a visible window and with a 1920 by 1080 window in Selenium 4 Python?
opts = webdriver.ChromeOptions(); opts.add_argument("--headless=new"); opts.add_argument("--window-size=1920,1080"); driver = webdriver.Chrome(options=opts)driver = webdriver.Chrome(headless=True)driver = webdriver.Chrome(); driver.headless = Truedriver = webdriver.Chrome(desired_capabilities={"headless": True})
This question is part of Pro+
Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.