1

I want to put full window, but it only leaves me 800x600

def driver(request):
from selenium import webdriver
from selenium.webdriver.chrome.options import Options

options = Options()
options.add_argument("start-maximized")
options.add_argument("disable-infobars")
options.add_argument("--disable-dev-shm-usage")
options.add_argument("--disable-gpu")
options.add_argument("--no-sandbox")
options.add_argument('--headless')

try:
    web_driver = webdriver.Chrome(chrome_options=options)
    yield web_driver
    web_driver.close()
except Exception as e:
    pytest.skip(e)

I'm doing tests with selenium, but the window is very inferior. help how could you put maximum window.

4

1 回答 1

1

You can set the window size by setting it:

web_driver = webdriver.Chrome(chrome_options=options)
# Resize the window to the screen width/height
web_driver.set_window_size(1024, 720)
于 2018-09-22T15:42:53.973 回答