Skip to content

[🐛 Bug]: v9 - Polyfill Manager executes code that breaks in old browsers #13750

@mhassan1

Description

@mhassan1

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

9.1.3

Node.js Version

20.12.2

Mode

Standalone Mode

Which capabilities are you using?

{
  browserName: 'chrome',
  browserVersion: '30.0',
  platformName: 'Windows',
  platformVersion: 'XP'
}

What happened?

When running a simple test against Chrome 30, I get WebDriverError: unknown error: Runtime.evaluate threw exception: SyntaxError: Unexpected token >. This is because of the arrow function here, which Chrome 30 does not support. Old browsers will also have an issue with globalThis being undefined.

What is your expected behavior?

Old browsers should not throw this exception.

How to reproduce the bug.

import { remote } from 'webdriverio'

const browser = await remote({
  capabilities: {
    browserName: 'chrome',
    browserVersion: '30.0',
    platformName: 'Windows',
    platformVersion: 'XP'
  },
  services: ['browserstack'],
  user: process.env.BROWSERSTACK_USERNAME,
  key: process.env.BROWSERSTACK_ACCESS_KEY
})

await browser.url('about:blank')

await browser.execute(function () { console.log('hi') })

await browser.deleteSession()

Relevant log output

2024-10-09T20:05:13.255Z INFO webdriver: DATA {
  script: '\n' +
    "            var __defProp = Object.defineProperty;var __name = (target, value) => __defProp(target, 'name', { value, configurable: true });globalThis.__name = __name;\n" +
    "            return (function () { console.log('hi') }).apply(null, arguments)\n" +
    '        ',
  args: []
}
2024-10-09T20:05:16.458Z DEBUG webdriver: request failed due to status 13
2024-10-09T20:05:16.458Z ERROR webdriver: WebDriverError: unknown error: Runtime.evaluate threw exception: SyntaxError: Unexpected token >
  (Session info: chrome=30.0.1599.101)
  (Driver info: chromedriver=2.6.232923,platform=Windows NT 5.2 SP2 x86)

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

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions