Frage

I am trying to start Chrome browser in full screen mode (similar to using F11) on Ubuntu 12.04. I am using the following code, but this doesn't see to work:

       if (browser.equalsIgnoreCase("chrome")) {
            //Set full screen mode (similar to F11)
            ChromeOptions options = new ChromeOptions();
            options.addArguments("start-fullscreen");
            //Create a new Chrome Driver
            System.setProperty("webdriver.chrome.driver","./lib/chromedriver");
            this.driver = new ChromeDriver(options);
        }

I am using Chrome version 34 with WebDriver version 2.41. Any suggestions?

War es hilfreich?

Lösung

Linux Mint 16, Chrome version 34.0.1847.132, Selenium 2.41. Full screen mode works fine. Try to use:

driver.manage().window().maximize();

to maximize browser window.

Edited.

Also you can try to run chrome in kiosk mode:

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

This works fine in Linux with Chrome 34.

Or try to press F11 like:

driver.findElement(By.tagName("html")).sendKeys(Keys.F11);

But for me it works fine only in Firefox.

Andere Tipps

If you're trying to send F11 to the browser, you can probably do it this way:

driver.FindElement(By.TagName("html")).SendKeys(Keys.F11);
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top