Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between the Selenium methods - maximize() and fullscreen()

Tags:

I just happened to notice that there is a fullscreen() method, which I had not noticed earlier, that is available with the interface WebDriver.Window.

As per the Selenium javadocs: -> fullscreen() - Fullscreen the current window if it is not already fullscreen -> maximize() - Maximizes the current window if it is not already maximized

I don't understand any difference in the explanations here. Both of them say the same thing.

When I tried to use driver.manage().window().fullscreen();, I got this error

org.openqa.selenium.UnsupportedCommandException: unknown command: session/b368564bbe1863857d7ce10cc5f38e38/window/fullscreen

Can someone help me understand the usage/difference of these 2 commands.

I am using Java 8 + Selenium 3.0.1 + Intellij 15 + Chrome 54.

like image 740
hifzur Avatar asked Nov 22 '16 11:11

hifzur


2 Answers

driver.manage().window().fullscreen();

  • The browser's menu bar is not visible
  • The whole desktop estate is covered up by the browser.
  • The Task bar is not visible

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

  • The browser's menu bar is visible
  • The whole desktop estate is not covered up by the browser.
  • The Task bar is visible
like image 123
Krishanu Chakraborty Avatar answered Sep 24 '22 16:09

Krishanu Chakraborty


On HP systems, on pressing F11, the screen goes in the fullscreen mode, and you will not be able to see the address bar, all you will see is the content of the page. Now this control varies from system to system, so you need to implement this command. And in the method you create, specify the key action that does this for your system. On the other hand, the maximize() maximizes the size of the browser window.

like image 26
Deadshot Avatar answered Sep 22 '22 16:09

Deadshot