简体   繁体   English

在Selenium中使用命令“ driver.manage()。window()。setPosition(new Point(0,-1000));”之后,无法最大化浏览器

[英]Not able to maximize browser after using the command “driver.manage().window().setPosition(new Point(0,-1000));” in Selenium

I used the following command to minimize chrome browser: 我使用以下命令最小化了chrome浏览器:

driver.manage().window().setPosition(new Point(0,-1000));

But later when I clicked on chrome browser in toolbar to maximize, its not maximizing. 但是后来当我单击工具栏上的chrome浏览器最大化时,它没有最大化。

Can anybody help on this one please, why its not working? 有人可以帮忙吗,为什么它不起作用?

The reason is that the command you're using doesn't Minimize the window, it moves its position off screen. 原因是您使用的命令不会最小化窗口,而是将其位置移出屏幕。 So when you're clicking in the toolbar it will be minimizing/maximizing as you click, but you just can't see it. 因此,当您在工具栏中单击时,单击时它将最小化/最大化,但看不到它。

If you wish to make the window visible again later in your code you can just reset the window position with 如果您希望稍后在代码中再次显示该窗口,则可以使用

driver.manage().window().setPosition(new Point(0,0))

暂无
暂无

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

相关问题 每次我们调用浏览器时,在 selenium 中使用 driver.manage().window().maximize() 是不是很好 - Is that good to use driver.manage().window().maximize() in selenium for every time we invoke browser driver.manage().window().maximize() 不适用于 Selenium 中的 chrome - driver.manage().window().maximize() is not working for chrome in Selenium Selenium Grid:如何使用RemoteWebDriver和ChromeDriver最大化浏览器窗口 - Selenium Grid: how to maximize browser window using RemoteWebDriver and ChromeDriver driver.manage().logs().get("浏览器"); 再次调用时不起作用 - driver.manage().logs().get("browser"); does not work when called again setPosition(1, 2) 比 setPosition(new Point(1, 2)) 快很多吗 - Is setPosition(1, 2) a lot faster than setPosition(new Point(1, 2)) 有没有办法在 driver.manage().timeouts() 方法之外设置隐式超时? - Is there a way to set implicit timeouts beyond the driver.manage().timeouts() method? 如何使用Java使用氦气最大化浏览器窗口? - How to maximize browser window with helium using Java? Chrome 浏览器 window 在 Selenium-grid 节点中未最大化 - Chrome Browser window is not maximize in Selenium-grid node 在切换情况下,无法使用Selenium Web驱动程序在其他浏览器中运行URL - Not able to Run URL in different Browser using Selenium web driver in Switch case condition 如何在 selenium 2 WebDriver 中找到当前使用窗口是最大化还是最小化? - How to find the whether the current using window is maximize or minimize in selenium 2 WebDriver?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM