'ChromeOptions not getting applied

I am trying to open the chrome browser with devtools open in maximized window. Following code does not work, driver opens the URL in a smaller window without devtools.

System.setProperty("webdriver.chrome.driver", "<path to chrome.exe>");

ChromeOptions options = new ChromeOptions();        
<String> chromeoptions = new ArrayList<String>();
chromeoptions.add("start-maximised");
chromeoptions.add("auto-open-devtools-for-tabs");
options.addArguments(chromeoptions);

WebDriver driver=new ChromeDriver(options);

driver.get("http://www.google.com");

I have also used Capabilities with no result.

DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability("chrome.binary", "<path to chrome exe>");
capabilities.setCapability(ChromeOptions.CAPABILITY, options);      
WebDriver driver=new ChromeDriver(capabilities);

I am using Chrome 75, selenium jar version 3.4.0

Any suggestion?



Solution 1:[1]

As per your code, there have some spelling mistake like("start-maximised") instead of ("--start-maximized")

kindly use the below code:

ChromeOptions options = new ChromeOptions();
options.addArguments("--start-maximized");
options.addArguments("--auto-open-devtools-for-tabs");
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);

WebDriver driver = new ChromeDriver(capabilities);

Solution 2:[2]

Update: I changed selenium version to 3.0.0 and It started working.

Solution 3:[3]

Try using chrome options like this. it'll download the correct chrome driver version automatically and also chrome options work correctly.

from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager

chrome_options = webdriver.ChromeOptions()
chrome_options.add_experimental_option("detach", True)
chrome_options.add_argument("--start-maximized")

driver = webdriver.Chrome(ChromeDriverManager().install(), options=chrome_options)

driver.get('https://www.facebook.com/');

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Amit Singh
Solution 2 Jai S
Solution 3 Hishan_98