webdriverio/webdriverio

[🐛 Bug]: scrollIntoView doesn't seem to work as expected for Firefox when the scrollable container scrolls horizontally

Open

#14,840 创建于 2025年11月4日

在 GitHub 查看
 (2 评论) (0 反应) (0 负责人)JavaScript (6,029 star) (1,793 fork)batch import
Bug 🐛help wanted

描述

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

9.20.0

Node.js Version

24.8.0

Mode

Standalone Mode

Which capabilities are you using?

What happened?

The call to scrollIntoView doens't work in Firefox but works in Chrome.

The context is that there's an horizontally scrollable container with the button being invisible to the right.

What is your expected behavior?

scrollIntoView should make the button visible so that it can be clicked.

How to reproduce the bug.

Clone https://github.com/julienw/issue-webdriver-click-scroll Run:

npm ci
npm test

The test uses click with an option parameter, which triggers a scrollIntoView call.

Compare with Chrome:

BROWSER=chrome npm test

Relevant log output

[0-0] 2025-11-04T15:45:59.066Z INFO webdriver: BIDI RESULT {"type":"success","id":10,"result":{"nodes":[{"type":"node","sharedId":"7ee7e483-4385-4893-a7f1-6d83929e3df0","value":{"nodeType":1,"localName":"button","namespaceURI":"http://www.w3.org/1999/xhtml","childNodeCount":1,"attributes":{"id":"hiddenButton"},"shadowRoot":null}}]}}
[0-0] 2025-11-04T15:45:59.071Z INFO webdriver: COMMAND performActions(<object>)
[0-0] 2025-11-04T15:45:59.072Z INFO webdriver: [POST] http://localhost:44005/session/727fd1cb-f54a-4152-ba4b-3f158824283c/actions
[0-0] 2025-11-04T15:45:59.072Z INFO webdriver: DATA {
[0-0]   actions: [
[0-0]     {
[0-0]       id: 'action1',
[0-0]       type: 'pointer',
[0-0]       parameters: [Object],
[0-0]       actions: [Array]
[0-0]     }
[0-0]   ]
[0-0] }
[0-0] 2025-11-04T15:45:59.215Z INFO webdriver: RESULT null
[0-0] 2025-11-04T15:45:59.215Z INFO webdriver: COMMAND releaseActions()
[0-0] 2025-11-04T15:45:59.216Z INFO webdriver: [DELETE] http://localhost:44005/session/727fd1cb-f54a-4152-ba4b-3f158824283c/actions
[0-0] 2025-11-04T15:45:59.223Z INFO webdriver: RESULT null
[0-0] 2025-11-04T15:45:59.223Z INFO webdriver: BIDI COMMAND browsingContext.locateNodes {"locator":{"type":"css","value":"#result"},"context":"f1a3ece5-2493-4ed6-81b1-f9a54323f6a7"}
[0-0] 2025-11-04T15:45:59.226Z INFO webdriver: BIDI RESULT {"type":"success","id":11,"result":{"nodes":[{"type":"node","sharedId":"ee937ca6-d12b-45a9-b6ce-ab2f84db785d","value":{"nodeType":1,"localName":"div","namespaceURI":"http://www.w3.org/1999/xhtml","childNodeCount":1,"attributes":{"id":"result"},"shadowRoot":null}}]}}
[0-0] 2025-11-04T15:45:59.230Z INFO webdriver: BIDI COMMAND script.callFunction {"functionDeclaration":"<Function[279 bytes] checkVisibility>","awaitPromise":true,"arguments":[{"sharedId":"ee937ca6-d12b-45a9-b6ce-ab2f84db785d"},{"type":"object","value":[["withinViewport",{"type":"boolean","value":false}],["contentVisibilityAuto",{"type":"boolean","value":true}],["opacityProperty",{"type":"boolean","value":true}],["visibilityProperty",{"type":"boolean","value":true}]]}],"target":{"context":"f1a3ece5-2493-4ed6-81b1-f9a54323f6a7"}}
[0-0] 2025-11-04T15:45:59.230Z INFO webdriver: COMMAND getElementCSSValue("ee937ca6-d12b-45a9-b6ce-ab2f84db785d", "display")
[0-0] 2025-11-04T15:45:59.231Z INFO webdriver: [GET] http://localhost:44005/session/727fd1cb-f54a-4152-ba4b-3f158824283c/element/ee937ca6-d12b-45a9-b6ce-ab2f84db785d/css/display
[0-0] 2025-11-04T15:45:59.233Z INFO webdriver: BIDI RESULT {"type":"success","id":12,"result":{"realm":"3aa2f0d7-2920-4d67-9f2f-77b2df8c4a15","type":"success","result":{"type":"boolean","value":false}}}
[0-0] 2025-11-04T15:45:59.237Z INFO webdriver: RESULT none
[0-0] Error in "Scroll and Click Test.should click button inside scrollable container without manual scrolling"
Error: expect(received).toBe(expected) // Object.is equality

Expected: true
Received: false
    at Context.<anonymous> (file:///home/julien/travail/git/issue-webdriver-click-scroll/test/specs/scroll.test.js:27:29)

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

贡献者指南