我正在尝试使用以下 javascript 启动后调整浏览器窗口的大小driver.get(url);
driver.manage().window().setSize(1200,800);但是,我收到一个错误'setSize 不是函数\n'。有人可以帮我解决这个问题吗,我也试过reSizeTo()了
3 回答

慕勒3428872
TA贡献1848条经验 获得超6个赞
我刚刚为我的问题找到了解决方案,下面的代码有效
driver.manage().window().setRect({width: 640, height: 480, x, y});

元芳怎么了
TA贡献1798条经验 获得超7个赞
2022年的这个功能:
var width = 800;
var height = 600;
driver.manage().window().setRect({x: 0, y: 0, width: width, height: height});
https://www.selenium.dev/documentation/en/webdriver/browser_manipulation/

添加回答
举报
0/150
提交
取消