-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
Description
Have you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
WebdriverIO Version
9.6.4
Node.js Version
20.17.0
Mode
Standalone Mode
Which capabilities are you using?
What happened?
Before version 9.6.0, the saveScreenshot API was working fine in CommonJS environment. Since version 9.6.0, it gives the following error message :
The `saveScreenshot` command for WebdriverIO.Browser is not available in this environment
What is your expected behavior?
Nothing in the release notes indicates such a breaking change, hence saveScreenshot API should work.
How to reproduce the bug.
const { remote } = require('webdriverio')
async function main () {
const browser = await remote({
capabilities: {
browserName: 'chrome',
}
})
await browser.navigateTo('https://www.google.com/ncr')
await browser.saveScreenshot('test.png')
await browser.deleteSession()
}
main()Relevant log output
C:\Users\ARNAUD\git\arnaud\ui5-test-runner>node test/webdriverio.cjs
Debugger listening on ws://127.0.0.1:53022/043aec93-4ca9-455e-ab7e-a19f06f33a77
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
2025-01-24T13:46:25.098Z INFO webdriver: Initiate new session using the WebDriver protocol
2025-01-24T13:46:25.459Z INFO webdriver: Using Chromedriver v132.0.6834.84 from cache directory C:\Users\ARNAUD\AppData\Local\Temp
2025-01-24T13:46:25.506Z INFO chromedriver: Starting ChromeDriver 132.0.6834.84 (c1a6c2d428b5b484febdecda9475aba38de5a502-refs/branch-heads/6834@{#3391}) on port 53025
2025-01-24T13:46:25.507Z INFO chromedriver: Remote connections are allowed by an allowlist (0.0.0.0).
2025-01-24T13:46:25.507Z INFO chromedriver: Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
2025-01-24T13:46:25.510Z INFO chromedriver: ChromeDriver was started successfully on port 53025.
2025-01-24T13:46:26.505Z INFO @wdio/utils: Started Chromedriver v132.0.6834.84 with params --port=53025 --allowed-origins=* --allowed-ips=0.0.0.0 in 1061ms on port 53025
2025-01-24T13:46:26.519Z INFO webdriver: [POST] http://localhost:53025/session
2025-01-24T13:46:26.519Z INFO webdriver: DATA {
capabilities: {
alwaysMatch: {
browserName: 'chrome',
'goog:chromeOptions': [Object],
webSocketUrl: true,
unhandledPromptBehavior: 'ignore'
},
firstMatch: [ {} ]
}
}
DevTools listening on ws://127.0.0.1:53032/devtools/browser/11e0c3bc-90fb-4209-ba2e-9a76ae6fb5b1
2025-01-24T13:46:27.266Z INFO webdriver: Register BiDi handler for session with id 67bebdac84d130d6578a51caf8d90065
2025-01-24T13:46:27.267Z INFO webdriver: Connect to webSocketUrl ws://127.0.0.1:53025/session/67bebdac84d130d6578a51caf8d90065
2025-01-24T13:46:27.276Z INFO webdriver: Connected session to Bidi protocol
2025-01-24T13:46:27.278Z INFO webdriver: BIDI COMMAND browsingContext.getTree {}
2025-01-24T13:46:27.280Z INFO webdriver: BIDI COMMAND session.subscribe {"events":["browsingContext.contextCreated"]}
2025-01-24T13:46:27.281Z INFO webdriver: BIDI COMMAND session.subscribe {"events":["log.entryAdded","browsingContext.navigationStarted"]}
2025-01-24T13:46:27.281Z INFO webdriver: BIDI COMMAND script.addPreloadScript { functionDeclaration: <PreloadScript[1402 bytes]>, contexts: undefined }
2025-01-24T13:46:27.282Z INFO webdriver: BIDI COMMAND session.subscribe {"events":["browsingContext.navigationStarted","network.responseCompleted","network.beforeRequestSent","network.fetchError"]}
2025-01-24T13:46:27.283Z INFO webdriver: BIDI COMMAND session.subscribe {"events":["browsingContext.userPromptOpened"]}
2025-01-24T13:46:27.284Z INFO webdriver: COMMAND getWindowHandle()
2025-01-24T13:46:27.284Z INFO webdriver: Connected to WebDriver Bidi interface at ws://127.0.0.1:53025/session/67bebdac84d130d6578a51caf8d90065
2025-01-24T13:46:27.284Z INFO webdriver: [GET] http://localhost:53025/session/67bebdac84d130d6578a51caf8d90065/window
2025-01-24T13:46:27.288Z INFO webdriver: RESULT C1CE9F8A4AC16CEC34B2A17CF1253476
2025-01-24T13:46:27.296Z INFO webdriver: BIDI RESULT {"id":1,"result":{"contexts":[{"children":[],"clientWindow":"","context":"C1CE9F8A4AC16CEC34B2A17CF1253476","originalOpener":null,"parent":null,"url":"about:blank","userContext":"default"}]},"type":"success"}
2025-01-24T13:46:27.297Z INFO webdriverio:PolyfillManager: Adding polyfill script to context with id C1CE9F8A4AC16CEC34B2A17CF1253476
2025-01-24T13:46:27.298Z INFO webdriver: BIDI COMMAND script.addPreloadScript { functionDeclaration: <PreloadScript[442 bytes]>, contexts: ["C1CE9F8A4AC16CEC34B2A17CF1253476"] }
2025-01-24T13:46:27.299Z INFO webdriver: BIDI COMMAND script.callFunction {"functionDeclaration":"<Function[442 bytes] webdriverioPolyfill>","target":{"children":[],"clientWindow":"","context":"C1CE9F8A4AC16CEC34B2A17CF1253476","originalOpener":null,"parent":null,"url":"about:blank","userContext":"default"},"awaitPromise":false}
2025-01-24T13:46:27.300Z INFO webdriver: BIDI RESULT {"id":2,"result":{},"type":"success"}
2025-01-24T13:46:27.302Z INFO webdriver: BIDI RESULT {"id":3,"result":{},"type":"success"}
2025-01-24T13:46:27.303Z INFO webdriver: BIDI RESULT {"id":6,"result":{},"type":"success"}
2025-01-24T13:46:27.303Z INFO webdriver: BIDI RESULT {"id":4,"result":{"script":"227331c4-2b92-47b8-98cf-10c2995432ad"},"type":"success"}
2025-01-24T13:46:27.304Z INFO webdriver: BIDI RESULT {"id":5,"result":{},"type":"success"}
2025-01-24T13:46:27.305Z INFO webdriver: BIDI RESULT {"id":7,"result":{"script":"4b19f2c0-5d47-486d-883f-444fdc92e491"},"type":"success"}
2025-01-24T13:46:27.305Z INFO webdriver: BIDI RESULT {"id":8,"result":{"realm":"8037484300320396187.-494327087809899673","result":{"type":"undefined"},"type":"success"},"type":"success"}
2025-01-24T13:46:27.306Z INFO webdriver: COMMAND navigateTo("https://www.google.com/ncr")
2025-01-24T13:46:27.307Z INFO webdriver: [POST] http://localhost:53025/session/67bebdac84d130d6578a51caf8d90065/url
2025-01-24T13:46:27.307Z INFO webdriver: DATA { url: 'https://www.google.com/ncr' }
2025-01-24T13:46:27.969Z INFO webdriverio:PolyfillManager: Adding polyfill script to context with id F4CC44DB8F6667DC81588FCCCFBB353A
2025-01-24T13:46:27.970Z INFO webdriver: BIDI COMMAND script.callFunction {"functionDeclaration":"<Function[442 bytes] webdriverioPolyfill>","target":{"children":null,"clientWindow":"","context":"F4CC44DB8F6667DC81588FCCCFBB353A","originalOpener":null,"parent":"C1CE9F8A4AC16CEC34B2A17CF1253476","url":"about:blank","userContext":"default"},"awaitPromise":false}
2025-01-24T13:46:28.438Z INFO webdriver: RESULT null
Waiting for the debugger to disconnect...
file:///C:/Users/ARNAUD/git/arnaud/ui5-test-runner/node_modules/webdriverio/build/index.js:536
throw new Error("The `saveScreenshot` command for WebdriverIO.Browser is not available in this environment");
^
Error: The `saveScreenshot` command for WebdriverIO.Browser is not available in this environment
at get saveScreenshot [as saveScreenshot] (file:///C:/Users/ARNAUD/git/arnaud/ui5-test-runner/node_modules/webdriverio/build/index.js:536:13)
at Browser.saveScreenshot (file:///C:/Users/ARNAUD/git/arnaud/ui5-test-runner/node_modules/webdriverio/build/index.js:4999:28)
at Browser.wrapCommandFn (file:///C:/Users/ARNAUD/git/arnaud/ui5-test-runner/node_modules/@wdio/utils/build/index.js:893:32)
at Browser.<anonymous> (file:///C:/Users/ARNAUD/git/arnaud/ui5-test-runner/node_modules/@wdio/utils/build/index.js:1005:20)
at main (C:\Users\ARNAUD\git\arnaud\ui5-test-runner\test\webdriverio.cjs:13:17)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Node.js v20.17.0
C:\Users\ARNAUD\git\arnaud\ui5-test-runner>Created TensorFlow Lite XNNPACK delegate for CPU.
Attempting to use a delegate that only supports static-sized tensors with a graph that has dynamic-sized tensors (tensor#-1 is a dynamic-sized tensor).
Code of Conduct
- I agree to follow this project's Code of Conduct
Is there an existing issue for this?
- I have searched the existing issues
Reactions are currently unavailable