Selenium Chrome Full Screen With Capabilities

935 views Asked by At

In my test code, I define some capabilities and get ChromeDriver like this:

WebDriver driver = new ChromeDriver(capabilities);

But I need to open Chrome in full screen in Mac OS X. I searched and saw that this code is used to maximize:

ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--kiosk");
driver = new ChromeDriver(chromeOptions);

But I have to use capabilities with Chrome driver and there is no ChromeDriver constructor that takes options ve capabilities. How can I use ChromeDriver capabilitest and options to open Chrome maximize in Mac OS X?

1

There are 1 answers

2
Guy On

You can add chromeOptions to capabilities

ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--kiosk");
capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
ChromeDriver driver = new ChromeDriver(capabilities);