admin管理员组文章数量:1334877
I'm trying to resize browser window after launching with below javascript
driver.get(url);
driver.manage().window().setSize(1200,800);
However, I'm getting an error
'setSize is not a function\n'.
Could someone please help me in resolving the issue, I have tried reSizeTo()
as well
I'm trying to resize browser window after launching with below javascript
driver.get(url);
driver.manage().window().setSize(1200,800);
However, I'm getting an error
'setSize is not a function\n'.
Could someone please help me in resolving the issue, I have tried reSizeTo()
as well
- 1 I just found a solution for my question, below code works driver.manage().window().setRect({width: 640, height: 480, x, y}); – Dev Commented Mar 9, 2020 at 11:00
- then post is as an answer instead of putting it in the ment – EugenSunic Commented Mar 9, 2020 at 11:02
- I'm sorry, I just added it as answer. Thank you @EugenSunic – Dev Commented Mar 9, 2020 at 11:03
3 Answers
Reset to default 7I just found a solution for my question, below code works
driver.manage().window().setRect({width: 640, height: 480, x, y});
This function in 2022 :
var width = 800;
var height = 600;
driver.manage().window().setRect({x: 0, y: 0, width: width, height: height});
https://www.selenium.dev/documentation/webdriver/interactions/windows/
From selenium doc: https://www.selenium.dev/selenium/docs/api/javascript/module/selenium-webdriver/lib/webdriver_exports_Window.html
it doesn't have method setSize
, you should use setRect
instead
本文标签: setSize() doesn39t work to set browser size in selenium using JavascriptStack Overflow
版权声明:本文标题:setSize() doesn't work to set browser size in selenium using Javascript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742332214a2454921.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论