nightwatch
nightwatch copied to clipboard
browser.resizeWindow doesn't work, but using browser.driver.manage().window().setRect does
Describe the bug
I recently upgraded from Nightwatch 1.7.11
to 2.3.0
and I noticed that browser.resizeWindow
doesn't work anymore.
I have tried making sure I am configuring things according to the release notes.
I am only using Chrome, and before running the test I do npm link chromedriver
.
I use TypeScript.
Sample test
Unfortunately I can't share too much of our code, but I have a command in commands/modalDrawer.ts
that looks like this
Doesn't work
import type { NightwatchBrowser } from "nightwatch";
exports.command = function (this: NightwatchBrowser): NightwatchBrowser {
browser.resizeWindow(375, 812);
return this;
};
Works
import type { NightwatchBrowser } from "nightwatch";
exports.command = function (this: NightwatchBrowser): NightwatchBrowser {
browser.driver.manage().window().setRect({width: 375, height: 812});
return this;
};
Run with command
$ node_modules/.bin/nightwatch -c ./nightwatch.conf.js
Verbose output
debug.log
→ Running command: resizeWindow (375, 812)
Request POST /session/207c181c1ae157684766da0f71bbb578/window/rect
{ x: undefined, y: undefined, width: undefined, height: undefined }
Response 200 POST /session/207c181c1ae157684766da0f71bbb578/window/rect (105ms)
{ value: { height: 1185, width: 1600, x: 22, y: 25 } }
→ Completed command: resizeWindow (375, 812) (107ms)
Configuration
nightwatch.json
N/A
Your Environment
Executable | Version |
---|---|
nightwatch --version |
2.3.0 |
npm --version |
8.1.2 |
yarn --version |
1.22.19 |
node --version |
v16.13.2 |
Browser driver | Version |
---|---|
chromedriver | 104.0.5112.79 |
selenium-server | selenium-server-standalone-3.141.59.jar |
OS | Version |
---|---|
macOS Monterey | 12.5 |