9

I am trying to send F11 to ChromeDriver, however it does not respond to it. When I press F11, it turns Chrome into fullscreen mode. When I send F11 through ChromeDriver, it does not. This is the same for any F-key in ChromeDriver. It works fine with FirefoxDriver and IEDriver, just not ChromeDriver. Is there any way I could get ChromeDriver into fullscreen mode ?

Note : Fullscreen mode is different from maximized mode, as it hides all toolbars.

4

7 に答える 7

14

I was able to solve it using kiosk mode, which keeps the browser in full screen

ChromeOptions options = new ChromeOptions();
options.addArguments("--kiosk");
WebDriver driver = new ChromeDriver(options);
于 2012-08-09T17:14:21.020 に答える
6
    ChromeOptions options = new ChromeOptions();
    options.addArguments("--start-fullscreen");
    WebDriver driver = new ChromeDriver(options);

if you use RemoteWebDriver:

    ChromeOptions options = new ChromeOptions();
    options.addArguments("--start-fullscreen");
    DesiredCapabilities capabilities = DesiredCapabilities.chrome();
    capabilities.setCapability(ChromeOptions.CAPABILITY, options);
    Instance = new RemoteWebDriver(new URL(<SeleniumServerURL>), capabilities);
于 2016-11-01T16:29:04.593 に答える
6

The argument is changed:

ChromeOptions options = new ChromeOptions();
options.addArguments("start-maximized");

Another option is change the startup script of google-chrome, set start-maximized as default.

于 2017-08-30T08:58:22.143 に答える
1
driver.manage().window().fullscreen();
于 2018-05-29T18:18:48.550 に答える
0

In my case, i fix the differences between selenium webdriver coordinates and screen absolute coordinates (root cause: chrome tab, header and address field size are ignored by selenium .getcoordinate mechanism) by this way:

String shortcutGoToFullScreen = Keys.chord(Keys.F11);
WebDriver.findElement(By.tagName("body")).sendKeys(shortcutGoToFullScreen);

Only one problem, that this fullscreen mode became non full after any page code updates. So, it should be used carefully )

于 2016-09-13T19:28:19.453 に答える
0

Use --start-fullscreen argument to Specify the browser should start in fullscreen mode, like if the user had pressed F11 right after startup.

ChromeOptions options = new ChromeOptions();
options.addArguments("--start-fullscreen");
WebDriver driver = new ChromeDriver(options);

You can change the behavior as you prefer by providing arguments to ChromeOptions.

Following link gives you in detail view of arguments and their behaviour. Hope it helps.

https://peter.sh/experiments/chromium-command-line-switches/#start-fullscreen

于 2019-11-04T08:40:42.477 に答える
0

With Powershell/Selenium I wrote the script:

$Driver = Start-SeChrome -Fullscreen -StartUrl "https://........."

This worked perfectly for me

于 2020-03-06T07:22:16.713 に答える