Skip to content

[🐛 Bug]: scrollIntoView speed regression after v8.23.0 #11721

@alisher-qa

Description

@alisher-qa

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

v8.24.0

Node.js Version

v18.17.1

Mode

WDIO Testrunner

Which capabilities are you using?

No response

What happened?

Seems that v8.23 and v8.24.0 have some kind of regression with scrollIntoView() method which seriously slows down test execution.

My project framework uses scrollIntoView() a lot, but even in test example (after npm init wdio ., example repo below) I can see about x2 execution time after adding scrollIntoView() call before each of 3 actions in login step. Even visually I see delays between steps (2 typing and 1 click).

v8.22 doesn't have this problem, even though it also has those lines in log, but seems they didn't affect speed (can be compared by commenting scrollIntoView lines):

ERROR webdriver: Request failed with status 500 due to move target out of bounds: move target out of bounds
(Session info: chrome=119.0.6045.159)
WARN webdriverio: Failed to execute "scrollIntoView" using WebDriver Actions API: move target out of bounds
(Session info: chrome=119.0.6045.159)!
Re-attempting using Element.scrollIntoView via Web API.

Reproduced with Chrome and Firefox.

What is your expected behavior?

scrollIntoView() calls should not affect test execution speed that much.
And maybe there shouldn't be error with failed request?

How to reproduce the bug.

To reproduce the bug:

  1. Clone https://github.com/alisher-qa/wdio-regression-example
  2. Run npm install inside both folders (v8.22 & v8.23+)
  3. The only difference between folders is package.json and package-lock.json
  4. Compare npm run wdio of two folders (not the first try, because it can download driver/browser)
  5. Open login.page.js in v8.23+ and comment lines with scrollIntoView, see that speed is improved

Relevant log output

[0-0] 2023-11-23T17:07:51.715Z INFO webdriver: COMMAND performActions(<object>)
[0-0] 2023-11-23T17:07:51.715Z INFO webdriver: [POST] http://0.0.0.0:37483/session/5027c56b64f9d9e0cd6ec51ecbd5de34/actions
[0-0] 2023-11-23T17:07:51.715Z INFO webdriver: DATA {
[0-0]   actions: [
[0-0]     { id: 'action6', type: 'wheel', parameters: {}, actions: [Array] }
[0-0]   ]
[0-0] }
[0-0] 2023-11-23T17:07:52.096Z WARN webdriver: Request failed with status 500 due to move target out of bounds
[0-0]   (Session info: chrome=119.0.6045.159)
[0-0] 2023-11-23T17:07:52.096Z INFO webdriver: Retrying 1/3
[0-0] 2023-11-23T17:07:52.097Z INFO webdriver: [POST] http://0.0.0.0:37483/session/5027c56b64f9d9e0cd6ec51ecbd5de34/actions
[0-0] 2023-11-23T17:07:52.097Z INFO webdriver: DATA {
[0-0]   actions: [
[0-0]     { id: 'action6', type: 'wheel', parameters: {}, actions: [Array] }
[0-0]   ]
[0-0] }
[0-0] 2023-11-23T17:07:52.465Z WARN webdriver: Request failed with status 500 due to move target out of bounds
[0-0]   (Session info: chrome=119.0.6045.159)
[0-0] 2023-11-23T17:07:52.465Z INFO webdriver: Retrying 2/3
[0-0] 2023-11-23T17:07:52.465Z INFO webdriver: [POST] http://0.0.0.0:37483/session/5027c56b64f9d9e0cd6ec51ecbd5de34/actions
[0-0] 2023-11-23T17:07:52.465Z INFO webdriver: DATA {
[0-0]   actions: [
[0-0]     { id: 'action6', type: 'wheel', parameters: {}, actions: [Array] }
[0-0]   ]
[0-0] }
[0-0] 2023-11-23T17:07:52.840Z WARN webdriver: Request failed with status 500 due to move target out of bounds
[0-0]   (Session info: chrome=119.0.6045.159)
[0-0] 2023-11-23T17:07:52.840Z INFO webdriver: Retrying 3/3
[0-0] 2023-11-23T17:07:52.840Z INFO webdriver: [POST] http://0.0.0.0:37483/session/5027c56b64f9d9e0cd6ec51ecbd5de34/actions
[0-0] 2023-11-23T17:07:52.840Z INFO webdriver: DATA {
[0-0]   actions: [
[0-0]     { id: 'action6', type: 'wheel', parameters: {}, actions: [Array] }
[0-0]   ]
[0-0] }
[0-0] 2023-11-23T17:07:53.218Z ERROR webdriver: Request failed with status 500 due to move target out of bounds: move target out of bounds
[0-0]   (Session info: chrome=119.0.6045.159)
[0-0] 2023-11-23T17:07:53.218Z WARN webdriverio: Failed to execute "scrollIntoView" using WebDriver Actions API: move target out of bounds
[0-0]   (Session info: chrome=119.0.6045.159)!
[0-0] Re-attempting using `Element.scrollIntoView` via Web API.
[0-0] 2023-11-23T17:07:53.218Z INFO webdriver: COMMAND executeScript("return ((elem, options) => elem.scrollIntoView(options)).apply(null, arguments)", <object>)
[0-0] 2023-11-23T17:07:53.218Z INFO webdriver: [POST] http://0.0.0.0:37483/session/5027c56b64f9d9e0cd6ec51ecbd5de34/execute/sync
[0-0] 2023-11-23T17:07:53.218Z INFO webdriver: DATA {
[0-0]   script: 'return ((elem, options) => elem.scrollIntoView(options)).apply(null, arguments)',
[0-0]   args: [
[0-0]     {
[0-0]       'element-6066-11e4-a52e-4f735466cecf': '97EC6C66AF44087DBF8062718A3ABCA2_element_24',
[0-0]       ELEMENT: '97EC6C66AF44087DBF8062718A3ABCA2_element_24'
[0-0]     },
[0-0]     { block: 'start', inline: 'nearest' }
[0-0]   ]
[0-0] }
[0-0] 2023-11-23T17:07:53.227Z INFO webdriver: RESULT null
[0-0] 2023-11-23T17:07:53.227Z INFO webdriver: COMMAND findElement("css selector", "button[type="submit"]")
[0-0] 2023-11-23T17:07:53.227Z INFO webdriver: [POST] http://0.0.0.0:37483/session/5027c56b64f9d9e0cd6ec51ecbd5de34/element
[0-0] 2023-11-23T17:07:53.227Z INFO webdriver: DATA { using: 'css selector', value: 'button[type="submit"]' }
[0-0] 2023-11-23T17:07:53.239Z INFO webdriver: RESULT {
[0-0]   'element-6066-11e4-a52e-4f735466cecf': '97EC6C66AF44087DBF8062718A3ABCA2_element_24'
[0-0] }
[0-0] 2023-11-23T17:07:53.241Z INFO webdriver: COMMAND elementClick("97EC6C66AF44087DBF8062718A3ABCA2_element_24")
[0-0] 2023-11-23T17:07:53.242Z INFO webdriver: [POST] http://0.0.0.0:37483/session/5027c56b64f9d9e0cd6ec51ecbd5de34/element/97EC6C66AF44087DBF8062718A3ABCA2_element_24/click
[0-0] 2023-11-23T17:07:53.953Z INFO webdriver: RESULT null
[0-0] 2023-11-23T17:07:53.956Z INFO webdriver: COMMAND findElement("css selector", "#flash")
[0-0] 2023-11-23T17:07:53.956Z INFO webdriver: [POST] http://0.0.0.0:37483/session/5027c56b64f9d9e0cd6ec51ecbd5de34/element
[0-0] 2023-11-23T17:07:53.956Z INFO webdriver: DATA { using: 'css selector', value: '#flash' }
[0-0] 2023-11-23T17:07:53.966Z INFO webdriver: RESULT {
[0-0]   'element-6066-11e4-a52e-4f735466cecf': '57EEB200079F28587EB091E21E5D5231_element_29'
[0-0] }
[0-0] 2023-11-23T17:07:53.970Z INFO webdriver: COMMAND findElements("css selector", "#flash")
[0-0] 2023-11-23T17:07:53.972Z INFO webdriver: [POST] http://0.0.0.0:37483/session/5027c56b64f9d9e0cd6ec51ecbd5de34/elements
[0-0] 2023-11-23T17:07:53.972Z INFO webdriver: DATA { using: 'css selector', value: '#flash' }
[0-0] 2023-11-23T17:07:53.986Z INFO webdriver: RESULT [
[0-0]   {
[0-0]     'element-6066-11e4-a52e-4f735466cecf': '57EEB200079F28587EB091E21E5D5231_element_29'
[0-0]   }
[0-0] ]
[0-0] 2023-11-23T17:07:53.991Z INFO webdriver: COMMAND findElement("css selector", "#flash")
[0-0] 2023-11-23T17:07:53.992Z INFO webdriver: [POST] http://0.0.0.0:37483/session/5027c56b64f9d9e0cd6ec51ecbd5de34/element
[0-0] 2023-11-23T17:07:53.992Z INFO webdriver: DATA { using: 'css selector', value: '#flash' }
[0-0] 2023-11-23T17:07:54.002Z INFO webdriver: RESULT {
[0-0]   'element-6066-11e4-a52e-4f735466cecf': '57EEB200079F28587EB091E21E5D5231_element_29'
[0-0] }
[0-0] 2023-11-23T17:07:54.005Z INFO webdriver: COMMAND getElementText("57EEB200079F28587EB091E21E5D5231_element_29")
[0-0] 2023-11-23T17:07:54.006Z INFO webdriver: [GET] http://0.0.0.0:37483/session/5027c56b64f9d9e0cd6ec51ecbd5de34/element/57EEB200079F28587EB091E21E5D5231_element_29/text
[0-0] 2023-11-23T17:07:54.015Z INFO webdriver: RESULT Your username is invalid!
[0-0] ×
[0-0] 2023-11-23T17:07:54.017Z INFO webdriver: COMMAND deleteSession()
[0-0] 2023-11-23T17:07:54.017Z INFO webdriver: [DELETE] http://0.0.0.0:37483/session/5027c56b64f9d9e0cd6ec51ecbd5de34
[0-0] 2023-11-23T17:07:54.071Z INFO webdriver: RESULT null
[0-0] 2023-11-23T17:07:54.072Z INFO webdriver: Kill /tmp/chromedriver/linux-119.0.6045.159/chromedriver-linux64/chromedriver driver process with command line: --port=37483 --allowed-origins=* --allowed-ips=0.0.0.0
[0-0] PASSED in chrome - file://+/features/login.feature
2023-11-23T17:07:54.192Z INFO @wdio/cli:launcher: Run onWorkerEnd hook
2023-11-23T17:07:54.193Z INFO @wdio/cli:launcher: Run onComplete hook

 "spec" Reporter:
------------------------------------------------------------------
[chrome 119.0.6045.159 linux #0-0] Running: chrome (v119.0.6045.159) on linux
[chrome 119.0.6045.159 linux #0-0] Session ID: 5027c56b64f9d9e0cd6ec51ecbd5de34
[chrome 119.0.6045.159 linux #0-0]
[chrome 119.0.6045.159 linux #0-0] » /features/login.feature
[chrome 119.0.6045.159 linux #0-0] The Internet Guinea Pig Website
[chrome 119.0.6045.159 linux #0-0] As a user, I can log into the secure area
[chrome 119.0.6045.159 linux #0-0]     Given I am on the login page
[chrome 119.0.6045.159 linux #0-0]     When I login with tomsmith and SuperSecretPassword!
[chrome 119.0.6045.159 linux #0-0]     Then I should see a flash message saying You logged into a secure area!
[chrome 119.0.6045.159 linux #0-0]
[chrome 119.0.6045.159 linux #0-0] As a user, I can log into the secure area
[chrome 119.0.6045.159 linux #0-0]     Given I am on the login page
[chrome 119.0.6045.159 linux #0-0]     When I login with foobar and barfoo
[chrome 119.0.6045.159 linux #0-0]     Then I should see a flash message saying Your username is invalid!
[chrome 119.0.6045.159 linux #0-0]
[chrome 119.0.6045.159 linux #0-0] 6 passing (17s)


Spec Files:      1 passed, 1 total (100% completed) in 00:00:19

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

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions