简体   繁体   English

如何在Selenium 3中移动浏览器window?

[英]How to move the browser window in Selenium 3?

The following code worked under older versions of Selenium but results in a timeout under Selenium 3:以下代码在旧版本的 Selenium 下工作,但在 Selenium 3 下导致超时:

WebDriver driver = new ChromeDriver();
driver.manage().window().setPosition(new Point(1315, 0));

What is the correct way of moving the browser window in Selenium 3?在 Selenium 3 中移动浏览器 window 的正确方法是什么?

I believe there is no way native way to resize, or manipulate browser windows in Selenium. 我相信没有任何方法可以在Selenium中调整或调整浏览器窗口的大小。

Source: https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/1750 来源: https//github.com/seleniumhq/selenium-google-code-issue-archive/issues/1750

The only simple way that I have seen it done in the past is what you did, using a point and setting the position. 我过去看到它完成的唯一简单方法就是您所做的,使用一个点并设置位置。

For python it is driver.set_window_position(-1920,0)对于 python 它是driver.set_window_position(-1920,0)

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

相关问题 如何将硒的焦点移到新的选项卡窗口? - How to move selenium's focus to the new tab window? 如何以编程方式访问,接受和继续使用“浏览器证书警报”窗口 - How to programmatically access, accept and move on with the Browser certificate alert window 如何通过拒绝Selenium Webdriver中的弹出窗口来关闭浏览器 - How to close the browser by rejecting popup window in selenium webdriver 如何使用Java调整Selenium WebDriver中当前浏览器窗口的大小? - How to resize current browser window in Selenium WebDriver with Java? 如何获得对Selenium Web驱动程序浏览器窗口的控制 - How to get control to selenium web driver browser window 如何为不同的浏览器类型打开隐身/私人 window 和 Selenium WD? - How to open incognito/private window with Selenium WD for different browser types? Selenium Grid:如何使用RemoteWebDriver和ChromeDriver最大化浏览器窗口 - Selenium Grid: how to maximize browser window using RemoteWebDriver and ChromeDriver 如何将由Selenium Web驱动程序打开的浏览器窗口置于最前面 - How to bring the browser window to front which is opened by selenium web driver 如何使用Java关闭Selenium WebDriver中的子浏览器窗口 - How to close child browser window in Selenium WebDriver using Java 如何将硒中的KeyStroke发送到浏览器窗口(无定位器) - How to send KeyStroke in selenium to browser window (without locator)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM