Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x selenium python全屏窗口_Python 3.x_Selenium_Selenium Webdriver_Chrome Options - Fatal编程技术网

Python 3.x selenium python全屏窗口

Python 3.x selenium python全屏窗口,python-3.x,selenium,selenium-webdriver,chrome-options,Python 3.x,Selenium,Selenium Webdriver,Chrome Options,我想把整个窗口,但它只留下我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

我想把整个窗口,但它只留下我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)

我正在用selenium做测试,但是窗口非常差。帮助如何设置最大窗口。

您可以通过设置窗口大小来设置窗口大小:

web_driver = webdriver.Chrome(chrome_options=options)
# Resize the window to the screen width/height
web_driver.set_window_size(1024, 720)