SeleniumHQ / selenium

A browser automation framework and ecosystem.
https://selenium.dev
Apache License 2.0
30.23k stars 8.12k forks source link

[🐛 Bug]: Tests in .side file work in IDE, don't work on CLI, don't export working scripts #14406

Closed cyrusae closed 1 month ago

cyrusae commented 1 month ago

What happened?

Similarly to this issue, when I attempt to run tests from the selenium-side-runner CLI they time out. I have hit a dead end for things I could possibly attempt to change/tinker with (see below) as far as I can tell.

The .side file I'm using at the time of this report is available here (disclosure of credentials here is a non-issue, it's a deliberately garbage classroom project and much of the problem to begin with is that the people who made it neither know how to troubleshoot it nor have the time to deal with questions so all I know is that ostensibly it works on their machines and not mine).

Tests created within the Selenium IDE in Edge will run manually in Edge but not from the CLI. Exporting to pytest also creates scripts that don't work. I suspect these facts may be related but don't have access to anyone qualified to figure it out meaningfully in relation to the project; teaching team says it "just works" for them. (Here is an example of a nonfunctional pytest export. Here are exports from a classmate's system that are also nonfunctional.)

I apologize for the vagueness here, I wish I knew more to tell you.

How can we reproduce the issue?

selenium-side-runner -X huskey.side

Relevant log output

C:\Users\cyrus\...>set NODE_DEBUG="*"

C:\Users\cyrus\...>selenium-side-runner -X huskey.side
  console.log
    Beginning test session

      at Object.<anonymous>.exports.default (src/connect.ts:9:11)

  console.info
    Building driver for chrome

      at WebDriverExecutor.getDriverSync (node_modules/@seleniumhq/side-runtime/src/webdriver.ts:172:14)

  console.info
    Driver attributes:{ capabilities: {}, server: '', browserName: 'chrome' }

      at WebDriverExecutor.getDriverSync (node_modules/@seleniumhq/side-runtime/src/webdriver.ts:173:14)

  console.error

              Failed to build driver for chrome
              Supplied capabilities: {}
              Server: none
              Error: Error: Driver took too long to build. This is likely an issue with the browser or driver.

              OS: win32
              Node: v20.16.0
              Selenium-Webdriver: 4.23.0

              This is breaking at the boundary of the following code in selenium-webdriver:

              // BEGIN SELENIUM-WEBDRIVER CODE
              const webdriver = require('selenium-webdriver')
              const driver = new webdriver.Builder().withCapabilities({}).forBrowser('chrome').build()
              // END SELENIUM-WEBDRIVER CODE

              To ensure the bug is in selenium IDE, please attempt to run the above code in a script or node REPL.
              You may have to npm install selenium-webdriver first.

              If you are unable to proceed further, please raise a bug here:
              https://github.com/SeleniumHQ/selenium/issues/new?assignees=&labels=I-defect%2Cneeds-triaging&projects=&template=bug-report.yml&title=%5B%F0%9F%90%9B+Bug%5D%3A+

              If this code works in selenium-webdriver, but not the IDE or side-runner, please raise a bug here:
              https://github.com/SeleniumHQ/selenium-ide/issues/new?assignees=&labels=&projects=&template=bug.md

      at WebDriverExecutor.getDriver (node_modules/@seleniumhq/side-runtime/src/webdriver.ts:216:17)
      at WebDriverExecutor.init (node_modules/@seleniumhq/side-runtime/src/webdriver.ts:259:21)
      at Object.<anonymous>.exports.default (src/connect.ts:10:3)
      at Object.<anonymous> (src/main.test.ts:130:5)

 FAIL  ../../AppData/Roaming/npm/node_modules/selenium-side-runner/dist/main.test.js (30.8 s)
  × Testing driver connection (30046 ms)

  ● Testing driver connection

    Driver took too long to build. This is likely an issue with the browser or driver.

      at Timeout._onTimeout (node_modules/@seleniumhq/side-runtime/src/webdriver.ts:200:13)

Test Suites: 1 failed, 1 total
Tests:       1 failed, 1 total
Snapshots:   0 total
Time:        30.864 s, estimated 31 s
Ran all test suites within paths "C:\Users\cyrus\AppData\Roaming\npm\node_modules\selenium-side-runner\dist\main.test.js".

C:\Users\cyrus\...>node --version
v20.16.0

C:\Users\cyrus\...>node
Welcome to Node.js v20.16.0.
Type ".help" for more information.
> const webdriver = require('selenium-webdriver')
undefined
> const driver = new webdriver.Builder().withCapabilities({}).forBrowser('chrome').build()
undefined
> driver
thenableWebDriverProxy {
  session_: Promise {
    <pending>,
    [Symbol(async_id_symbol)]: 174,
    [Symbol(trigger_async_id_symbol)]: 173
  },
  executor_: Executor {
    customCommands_: Map(13) {
      'launchApp' => [Object],
      'getNetworkConditions' => [Object],
      'setNetworkConditions' => [Object],
      'deleteNetworkConditions' => [Object],
      'sendDevToolsCommand' => [Object],
      'sendAndGetDevToolsCommand' => [Object],
      'setPermission' => [Object],
      'getCastSinks' => [Object],
      'setCastSinkToUse' => [Object],
      'startDesktopMirroring' => [Object],
      'setCastTabMirroring' => [Object],
      'getCastIssueMessage' => [Object],
      'stopCasting' => [Object]
    },
    log_: Logger {
      name_: 'driver.http.Executor',
      level_: null,
      parent_: [Logger],
      handlers_: null
    }
  },
  fileDetector_: null,
  onQuit_: [Function: onQuit],
  authenticatorId_: null,
  pinnedScripts_: {},
  then: [Function: bound then],
  catch: [Function: bound catch]
}

Operating System

Windows 11

Selenium version

Python 3.12(?)

What are the browser(s) and version(s) where you see this issue?

Selenium GUI works as Edge plugin (this is where I am making the tests)

What are the browser driver(s) and version(s) where you see this issue?

ChromeDriver 127.0.6533.119

Are you using Selenium Grid?

No response

github-actions[bot] commented 1 month ago

@cyrusae, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

github-actions[bot] commented 1 month ago

💬 Please ask questions at:

github-actions[bot] commented 3 days ago

This issue has been automatically locked since there has not been any recent activity since it was closed. Please open a new issue for related bugs.