简体   繁体   English

Selenium 方法之间有什么区别 - maximize() 和 fullscreen()

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

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 .我只是碰巧注意到有一个fullscreen()方法,我之前没有注意到,它可用于接口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根据 Selenium javadocs: -> fullscreen() - 如果当前窗口还不是全屏,则全屏显示 -> maximize() - 如果当前窗口尚未最大化,则最大化当前窗口

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();当我尝试使用driver.manage().window().fullscreen(); , I got this error ,我收到了这个错误

org.openqa.selenium.UnsupportedCommandException: unknown command: session/b368564bbe1863857d7ce10cc5f38e38/window/fullscreen org.openqa.selenium.UnsupportedCommandException:未知命令: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.我使用的是 Java 8 + Selenium 3.0.1 + Intellij 15 + Chrome 54。

driver.manage().window().fullscreen(); 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(); 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任务栏可见

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.在 HP 系统上,按 F11,屏幕进入全屏模式,您将看不到地址栏,您只能看到页面的内容。 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.另一方面, maximize()最大化浏览器窗口的大小。

It is a known issue.这是一个已知问题。 you can find the issue details here .您可以在此处找到问题详细信息。 observed in almost all environments and the issue is still in Open state.在几乎所有环境中都观察到,问题仍处于Open状态。

I also got the same error when used fullscreen() in the following environment:在以下环境中使用fullscreen()时,我也遇到了同样的错误:

Windows 7  - 64
Selenium 3.0.1
Chrome 54.0.9
Java 8

fullscreen() 与 selenium 的 Window 类有关,并且尊重 maximize()= 它将以最小化,关闭..按钮全屏显示 FullScreen() = 它不会以最小化,关闭..buttons 显示全屏,有单击 esc 以获取浏览器按钮

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM