Reputation: 1035
I need to open the maximized page, but selenium does not work. It just opens the page usually.
from selenium.webdriver.chrome.options import Options
options = Options()
options.add_argument("--start-maximized")
driver = webdriver.Chrome(executable_path=r'/Users/chromedriver', options=options)
Upvotes: 1
Views: 1906
Reputation: 33361
The --
shouldn't be there.
The correct syntax is:
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
options = Options()
options.add_argument("start-maximized")
webdriver_service = Service('C:\webdrivers\chromedriver.exe')
driver = webdriver.Chrome(options=options, service=webdriver_service)
Upvotes: 0
Reputation: 1070
Per this post How to maximize chrome browser in default when using selenium in python you can try chrome_options.add_argument("--start-maximized")
and depending on your version of chromedriver, it's worth reading through this post: How to maximize the browser window in Selenium WebDriver (Selenium 2) using C#?
driver.maximize_window()
also seems to be an option to try.
Upvotes: 2