如何在Selenium 3中移动浏览器窗口? [英] How to move the browser window in Selenium 3?

查看:50
本文介绍了如何在Selenium 3中移动浏览器窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下代码在旧版本的Selenium下工作,但在Selenium 3下导致超时:

The following code worked under older versions of Selenium but results in a timeout under Selenium 3:

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

在Selenium 3中移动浏览器窗口的正确方法是什么?

What is the correct way of moving the browser window in Selenium 3?

推荐答案

我相信没有任何一种原生方法可以在Selenium中调整大小或操纵浏览器窗​​口.

I believe there is no way native way to resize, or manipulate browser windows in Selenium.

来源: 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.

这篇关于如何在Selenium 3中移动浏览器窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆