SeleniumHQ / selenium-ide

Open Source record and playback test automation for the web.
https://selenium.dev/selenium-ide/
Apache License 2.0
2.84k stars 768 forks source link

[๐Ÿ› Bug]: selenium fail to run side file - Error: Driver took too long to build #1815

Open jackchuong opened 7 months ago

jackchuong commented 7 months ago

What happened?

Hi all, On my Windows 10, I have Chrome browser Version 123.0.6312.123 (Official Build) (64-bit) with Selenium IDE extension installed. I recorded a simple test like access to https://opensource-demo.orangehrmlive.com/ --> login --> logout , saved as test3.side I can run test with Selenium IDE successfully.

I installed nodejs and npm

C:\Users\jack.chuong\Downloads>node -v
v20.12.2
C:\Users\jack.chuong\Downloads>npm -v
10.5.0

Then I use npm to install selenium-side-runner and chromedriver

C:\Users\jack.chuong\Downloads>selenium-side-runner --version
4.0.5
C:\Users\jack.chuong\Downloads>chromedriver --version
ChromeDriver 123.0.6312.105 (399174dbe6eff0f59de9a6096129c0c827002b3a-refs/branch-heads/6312@{#761})

When I tried to run test3.side with selenium-side-runner I got error as below

C:\Users\jack.chuong\Downloads>selenium-side-runner -X test3.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.12.2
              Selenium-Webdriver: 4.19.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 (31.04 s)
  ร— Testing driver connection (30086 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:        31.16 s, estimated 32 s
Ran all test suites within paths "C:\Users\jack.chuong\AppData\Roaming\npm\node_modules\selenium-side-runner\dist\main.test.js".

How can we reproduce the issue?

{
  "id": "5e433d3a-9418-4d87-80e9-7bc3ad30941e",
  "version": "2.0",
  "name": "test3",
  "url": "https://opensource-demo.orangehrmlive.com",
  "tests": [{
    "id": "aa835abb-ebea-4643-82e2-03d0e1797faf",
    "name": "test3",
    "commands": [{
      "id": "ed29e1d3-5e46-4101-8872-ce1ee4674383",
      "comment": "",
      "command": "open",
      "target": "/web/index.php/auth/login",
      "targets": [],
      "value": ""
    }, {
      "id": "128b58cf-852f-4454-acc2-dcb383d17128",
      "comment": "",
      "command": "setWindowSize",
      "target": "1366x728",
      "targets": [],
      "value": ""
    }, {
      "id": "4baa7371-2bdf-4400-801f-17e9c7471962",
      "comment": "",
      "command": "click",
      "target": "name=username",
      "targets": [
        ["name=username", "name"],
        ["css=.oxd-input--focus", "css:finder"],
        ["xpath=//input[@name='username']", "xpath:attributes"],
        ["xpath=//div[@id='app']/div/div/div/div/div[2]/div[2]/form/div/div/div[2]/input", "xpath:idRelative"],
        ["xpath=//div[2]/input", "xpath:position"]
      ],
      "value": ""
    }, {
      "id": "86f17c96-705b-4014-b377-96a461b77aeb",
      "comment": "",
      "command": "type",
      "target": "name=username",
      "targets": [
        ["name=username", "name"],
        ["css=.oxd-input--focus", "css:finder"],
        ["xpath=//input[@name='username']", "xpath:attributes"],
        ["xpath=//div[@id='app']/div/div/div/div/div[2]/div[2]/form/div/div/div[2]/input", "xpath:idRelative"],
        ["xpath=//div[2]/input", "xpath:position"]
      ],
      "value": "Admin"
    }, {
      "id": "40a05796-eb8e-4341-8b38-5c78593e4813",
      "comment": "",
      "command": "type",
      "target": "name=password",
      "targets": [
        ["name=password", "name"],
        ["css=.oxd-input--focus", "css:finder"],
        ["xpath=//input[@name='password']", "xpath:attributes"],
        ["xpath=//div[@id='app']/div/div/div/div/div[2]/div[2]/form/div[2]/div/div[2]/input", "xpath:idRelative"],
        ["xpath=//div[2]/div/div[2]/input", "xpath:position"]
      ],
      "value": "admin123"
    }, {
      "id": "3fbe4fb0-d619-447a-9d6b-e13ef4e07688",
      "comment": "",
      "command": "click",
      "target": "css=.oxd-button",
      "targets": [
        ["css=.oxd-button", "css:finder"],
        ["xpath=//button[@type='submit']", "xpath:attributes"],
        ["xpath=//div[@id='app']/div/div/div/div/div[2]/div[2]/form/div[3]/button", "xpath:idRelative"],
        ["xpath=//button", "xpath:position"],
        ["xpath=//button[contains(.,'Login')]", "xpath:innerText"]
      ],
      "value": ""
    }, {
      "id": "d9e199da-2e2b-4f4f-b563-91ccfb1af453",
      "comment": "",
      "command": "click",
      "target": "css=.oxd-userdropdown-name",
      "targets": [
        ["css=.oxd-userdropdown-name", "css:finder"],
        ["xpath=//div[@id='app']/div/div/header/div/div[2]/ul/li/span/p", "xpath:idRelative"],
        ["xpath=//p", "xpath:position"],
        ["xpath=//p[contains(.,'First Last')]", "xpath:innerText"]
      ],
      "value": ""
    }, {
      "id": "5486f213-0339-4cf3-91ba-5e6868a8fb6a",
      "comment": "",
      "command": "click",
      "target": "linkText=Logout",
      "targets": [
        ["linkText=Logout", "linkText"],
        ["css=li:nth-child(4) > .oxd-userdropdown-link", "css:finder"],
        ["xpath=//a[contains(text(),'Logout')]", "xpath:link"],
        ["xpath=//div[@id='app']/div/div/header/div/div[2]/ul/li/ul/li[4]/a", "xpath:idRelative"],
        ["xpath=//a[contains(@href, '/web/index.php/auth/logout')]", "xpath:href"],
        ["xpath=//li/ul/li[4]/a", "xpath:position"],
        ["xpath=//a[contains(.,'Logout')]", "xpath:innerText"]
      ],
      "value": ""
    }, {
      "id": "e4056d12-d0bc-47c5-8b29-5f180c0dff61",
      "comment": "",
      "command": "close",
      "target": "",
      "targets": [],
      "value": ""
    }]
  }],
  "suites": [{
    "id": "c341457c-b767-41e7-be85-aec02f650cf1",
    "name": "Default Suite",
    "persistSession": false,
    "parallel": false,
    "timeout": 300,
    "tests": ["aa835abb-ebea-4643-82e2-03d0e1797faf"]
  }],
  "urls": ["https://opensource-demo.orangehrmlive.com/"],
  "plugins": []
}

Relevant log output

C:\Users\jack.chuong\Downloads>selenium-side-runner -X test3.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.12.2
              Selenium-Webdriver: 4.19.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 (31.04 s)
  ร— Testing driver connection (30086 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:        31.16 s, estimated 32 s
Ran all test suites within paths "C:\Users\jack.chuong\AppData\Roaming\npm\node_modules\selenium-side-runner\dist\main.test.js".

Operating System

Windows 10

Selenium version

Node: v20.12.2 Selenium-Webdriver: 4.19.0

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

Chrome browser Version 123.0.6312.123 (Official Build) (64-bit)

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

Version 123.0.6312.123 (Official Build) (64-bit)

Are you using Selenium Grid?

no

github-actions[bot] commented 7 months ago

@jackchuong, 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!

VietND96 commented 7 months ago

FAIL ../AppData/Roaming/npm/node_modules/selenium-side-runner/dist/main.test.js (31.04 s) ร— Testing driver connection (30086 ms)

It could be due to your network connection causing the driver to take a long time to download & build

Can you also try to pre-run npm install -g chromedriver once to initialize the driver separately?

If it still fails, try to find any process in Windows Task Manager that keeps chromedriver.exe running before, kill it, and rerun.

Also, I don't know -X is represent for which config. However without -X I had a run successfully as below

PS D:\Code\GitHub\selenium-ide> selenium-side-runner test3.side
info: Running test test3

 RUNS  C:/Users/ndviet/AppData/Roaming/npm/node_modules/selenium-side-runner/dist/main.test.js
info: Finished test test3 Success
 PASS  C:/Users/ndviet/AppData/Roaming/npm/node_modules/selenium-side-runner/dist/main.test.js (15.546 s)
  Running project test3
    Running suite Default Suite
      โˆš Running test test3 (14573 ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        15.655 s
jackchuong commented 7 months ago

Can you also try to pre-run npm install -g chromedriver once to initialize the driver separately?

Yes

C:\Users\jack.chuong\Downloads>npm install -g chromedriver

changed 63 packages in 17s

2 packages are looking for funding
  run `npm fund` for details

C:\Users\jack.chuong\Downloads>chromedriver --version
ChromeDriver 123.0.6312.105 (399174dbe6eff0f59de9a6096129c0c827002b3a-refs/branch-heads/6312@{#761})

If it still fails, try to find any process in Windows Task Manager that keeps chromedriver.exe running before, kill it, and rerun.

There is no process in Windows Task Manager that keeps chromedriver.exe running before.

Also, I don't know -X is represent for which config


C:\Users\jack.chuong\Downloads>selenium-side-runner --help
Usage: bin [options] your-project-glob-here-*.side [variadic-project-globs-*.side]

Options: -V, --version output the version number --base-url [url] Override the base URL that was set in the IDE -c, --capabilities [list] Webdriver capabilities -j, --jest-options [list] Options to configure Jest, wrap in extra quotes to allow shell to process (default: "\"\"") -s, --server [url] Webdriver remote server -r, --retries [number] Retry tests N times on failures, thin wrapper on jest.retryTimes (default: 0) -f, --filter [string] Run suites matching name, takes a regex without slashes, eg (^(hello|goodbye).*$) -w, --max-workers [number] Maximum amount of workers that will run your tests, defaults to number of cores -t, --timeout [number] The maximimum amount of time, in milliseconds, to spend attempting to locate an element. (default: 15000) (default: 15000) -T, --jest-timeout [number] The maximimum amount of time, in milliseconds, to wait for a test to finish. (default: 60000) (default: 60000) -x, --proxy-type [type] Type of proxy to use (one of: direct, manual, pac, socks, system) -y, --proxy-options [list] Proxy options to pass, for use with manual, pac and socks proxies -n, --config-file [filepath] Use specified YAML file for configuration. (default: .side.yml) -o, --output-directory [directory] Write test results as json to file in specified directory. Name will be based on timestamp. -z, --screenshot-failure-directory [directory] Write screenshots of failed tests to file in specified directory. Name will be based on test + timestamp. -f, --force Forcibly run the project, regardless of project's version -d, --debug Print debug logs -D, --debug-startup Print debug startup logs -X, --debug-connection-mode Debug driver connection mode -h, --help display help for command

Without `-X` I get error as below

C:\Users\jack.chuong\Downloads>selenium-side-runner test3.side info: Running test test3 FAIL ../AppData/Roaming/npm/node_modules/selenium-side-runner/dist/main.test.js (31.115 s) Running project test3 Running suite Default Suite ร— Running test test3 (30011 ms)

โ— Running project test3 โ€บ Running suite Default Suite โ€บ Running test test3

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: 31.24 s, estimated 32 s Ran all test suites within paths "C:\Users\jack.chuong\AppData\Roaming\npm\node_modules\selenium-side-runner\dist\main.test.js".



I tried with another Windows 11 , still same error.
VietND96 commented 7 months ago

Oh ok, based on few info in your logs

OS: win32 Node: v20.12.2 Selenium-Webdriver: 4.19.0 chromedriver --version ChromeDriver 123.0.6312.105 (399174dbe6eff0f59de9a6096129c0c827002b3a-refs/branch-heads/6312@{#761})

If accessing these 2 links directly, how long it takes to complete the download? is it within 30s? If no, need to figure out a config to extend that timeout (something needs to be asked in project selenium-ide)

Another Windows 11 with the same error, is it also win32? If yes, can you also try a machine win64 to see. If win64 can work, then the driver has something wrong with win32 that needs to ask chromedriver team

Another trick you can try to change the policy that will allow to run the PowerShell script (open PS run as administrators), then exec selenium-side-runner in PowerShell instead of CMD to see any helps

Set-ExecutionPolicy -Scope CurrentUser RemoteSigned -Force
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force
jackchuong commented 7 months ago

@VietND96 My both Windows 10 & 11 are 64 bit OS. Capture

I tried PowerShell as administrators and still get same error

PS C:\Windows\system32> Get-ExecutionPolicy
RemoteSigned

PS C:\Windows\system32> Get-ExecutionPolicy -Scope Process
Bypass

And yes, it takes more then 30s to complete the download, my average download speed is 2.87 MB/s , so it takes about 50s for each file.

VietND96 commented 7 months ago

Can you try this command selenium-side-runner -D -d -X --proxy-type direct test3.side By running this command, I saw a log appear very fast (in case run successfully) that it tried to connect to 127.0.0.1:51xxx, it looks like the port is random each run to launch the chromedriver. If it stops with more logs helpful, let's check if it could be due to the firewall or something else can block the port or process of chromedriver.exe

jackchuong commented 7 months ago

I print as much information as possible here:

PS C:\Users\jack.chuong\Downloads> selenium-side-runner -D -d -X --proxy-type direct test3.side
Configuration: {
  baseUrl: '',
  capabilities: { browserName: 'chrome', proxy: { proxyType: 'direct' } },
  debug: true,
  debugConnectionMode: true,
  debugStartup: true,
  filter: '.*',
  force: undefined,
  maxWorkers: 8,
  screenshotFailureDirectory: undefined,
  projects: [ 'C:\\Users\\jack.chuong\\Downloads\\test3.side' ],
  proxyOptions: {},
  proxyType: 'direct',
  retries: 0,
  runId: '15affc13ff18577918a97e64c972172b',
  path: 'C:\\Users\\jack.chuong\\AppData\\Roaming\\npm\\node_modules\\',
  server: '',
  jestTimeout: 60000,
  timeout: 15000
}
Jest command: node C:\Users\jack.chuong\AppData\Roaming\npm\node_modules\selenium-side-runner\node_modules\jest\bin\jest.js [
  '--config=C:\\Users\\jack.chuong\\AppData\\Roaming\\npm\\node_modules\\selenium-side-runner\\runner.jest.config.js',
  '--maxConcurrency=8',
  '--runTestsByPath',
  'C:\\Users\\jack.chuong\\AppData\\Roaming\\npm\\node_modules\\selenium-side-runner\\dist\\main.test.js'
] {
  ALLUSERSPROFILE: 'C:\\ProgramData',
  APPDATA: 'C:\\Users\\jack.chuong\\AppData\\Roaming',
  ChocolateyInstall: 'C:\\ProgramData\\chocolatey',
  ChocolateyLastPathUpdate: '133386376887221046',
  CommonProgramFiles: 'C:\\Program Files\\Common Files',
  'CommonProgramFiles(x86)': 'C:\\Program Files (x86)\\Common Files',
  CommonProgramW6432: 'C:\\Program Files\\Common Files',
  ComSpec: 'C:\\Windows\\system32\\cmd.exe',
  DriverData: 'C:\\Windows\\System32\\Drivers\\DriverData',                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         ',
  HOMEDRIVE: 'C:',
  HOMEPATH: '\\Users\\jack.chuong',
  LOCALAPPDATA: 'C:\\Users\\jack.chuong\\AppData\\Local',
  NUMBER_OF_PROCESSORS: '8',
  OS: 'Windows_NT',
  Path: 'C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath;C:\\Program Files (x86)\\Microsoft SDKs\\Azure\\CLI2\\wbin;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;C:\\Program Files\\PuTTY\\;C:\\Program Files\\Git\\cmd;C:\\ProgramData\\chocolatey\\bin;C:\\Program Files\\nodejs\\;C:\\Users\\jack.chuong\\scoop\\shims;C:\\Users\\jack.chuong\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Program Files\\Azure Data Studio\\bin;C:\\Users\\jack.chuong;C:\\Users\\jack.chuong\\AppData\\Roaming\\Python\\Python310\\Scripts\\;C:\\Users\\jack.chuong\\AppData\\Roaming\\npm',
  PATHEXT: '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL',
  PROCESSOR_ARCHITECTURE: 'AMD64',
  PROCESSOR_IDENTIFIER: 'Intel64 Family 6 Model 142 Stepping 11, GenuineIntel',
  PROCESSOR_LEVEL: '6',
  PROCESSOR_REVISION: '8e0b',
  ProgramData: 'C:\\ProgramData',
  ProgramFiles: 'C:\\Program Files',
  'ProgramFiles(x86)': 'C:\\Program Files (x86)',
  ProgramW6432: 'C:\\Program Files',
  PSModulePath: 'C:\\Users\\jack.chuong\\Documents\\WindowsPowerShell\\Modules;C:\\Program Files\\WindowsPowerShell\\Modules;C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\Modules;C:\\Program Files\\SharePoint Online Management Shell\\',
  PUBLIC: 'C:\\Users\\Public',
  SystemDrive: 'C:',
  SystemRoot: 'C:\\Windows',
  TEMP: 'C:\\Users\\JACK~1.CHU\\AppData\\Local\\Temp',
  TMP: 'C:\\Users\\JACK~1.CHU\\AppData\\Local\\Temp',
  windir: 'C:\\Windows',
  ZES_ENABLE_SYSMAN: '1',
  __PSLockDownPolicy: '0',
  SE_CONFIGURATION: '{"baseUrl":"","capabilities":{"browserName":"chrome","proxy":{"proxyType":"direct"}},"debug":true,"debugConnectionMode":true,"debugStartup":true,"filter":".*","maxWorkers":8,"projects":["C:\\\\Users\\\\jack.chuong\\\\Downloads\\\\test3.side"],"proxyOptions":{},"proxyType":"direct","retries":0,"runId":"15affc13ff18577918a97e64c972172b","path":"C:\\\\Users\\\\jack.chuong\\\\AppData\\\\Roaming\\\\npm\\\\node_modules\\\\","server":"","jestTimeout":60000,"timeout":15000}'
}
  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: { proxy: { proxyType: 'direct' } },
      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: {"proxy":{"proxyType":"direct"}}
              Server: none
              Error: Error: Driver took too long to build. This is likely an issue with the browser or driver.

              OS: win32
              Node: v20.12.2
              Selenium-Webdriver: 4.19.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({"proxy":{"proxyType":"direct"}}).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 (31.007 s)
  ร— Testing driver connection (30058 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:        31.129 s
Ran all test suites within paths "C:\Users\jack.chuong\AppData\Roaming\npm\node_modules\selenium-side-runner\dist\main.test.js".
toddtarsi commented 7 months ago

Can you try running this and posting the output?

npm install selenium-webdriver && node -e "const webdriver = require('selenium-webdriver'); const driver = new webdriver.Builder().withCapabilities({'proxy':{'proxyType':'direct'}}).forBrowser('chrome').build();"
jackchuong commented 7 months ago

There is no output at console but it creates some files and folders , I attached them below.

PS C:\Windows\system32> cd C:\Users\jack.chuong\Downloads
PS C:\Users\jack.chuong\Downloads> npm install selenium-webdriver && node -e "const webdriver = require('selenium-webdriver'); const driver = new webdriver.Builder().withCapabilities({'proxy':{'proxyType':'direct'}}).forBrowser('chrome').build();"
At line:1 char:32
+ npm install selenium-webdriver && node -e "const webdriver = require( ...
+                                ~~
The token '&&' is not a valid statement separator in this version.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : InvalidEndOfLine

PS C:\Users\jack.chuong\Downloads> npm install selenium-webdriver                                                                                                                               
added 16 packages in 3s
PS C:\Users\jack.chuong\Downloads> node -e "const webdriver = require('selenium-webdriver'); const driver = new webdriver.Builder().withCapabilities({'proxy':{'proxyType':'direct'}}).forBrowser('chrome').build();"
PS C:\Users\jack.chuong\Downloads>

node-output.zip It's .7z file but I have to change file extension to .zip so I can upload it.

toddtarsi commented 7 months ago

Ah, windows, my mistake. Can you try the following two commands instead?

npm i -g selenium-webdriver;
node -e "const webdriver = require('selenium-webdriver'); const driver = new webdriver.Builder().withCapabilities({'proxy':{'proxyType':'direct'}}).forBrowser('chrome').build();"

EDIT: Oh, nice. Thanks for splitting that. Okay, reading a bit closer.

toddtarsi commented 7 months ago

What happens if you do this?

node -e "const webdriver = require('selenium-webdriver'); const driver = new webdriver.Builder().withCapabilities({'proxy':{'proxyType':'direct'}}).forBrowser('chrome').build(); driver.get('https://www.google.com').then(() => setTimeout(() => driver.close(), 3000));"

Does a Chrome browser window appear for you for 3 seconds and then disappear?

jackchuong commented 7 months ago

@toddtarsi PS C:\Users\jack.chuong\Downloads> node -e "const webdriver = require('selenium-webdriver'); const driver = new webdriver.Builder().withCapabilities({'proxy':{'proxyType':'direct'}}).forBrowser('chrome').build(); driver.get('https://www.google.com').then(() => setTimeout(() => driver.close(), 3000));" No, nothing happens. I have also noticed this behavior, I watched some tutorials on youtube before trying selenium ide and selenium-side-runner :) C:\Users\jack.chuong\Downloads>selenium-side-runner test3.side should open my chrome browser and do steps in .side file , but I get error instead

toddtarsi commented 7 months ago

Yes, okay. If this doesn't occur in selenium-webdriver, this won't work here as it extends that tool. Can you use this code as your point of conversation there? This is getting to a spot where the Selenium core team would be an order of magnitude more helpful than I am.

toddtarsi commented 7 months ago

Use the code to drive discussions in the main channel of the Selenium user group.

https://www.selenium.dev/support/

They'll help you with this there. I want to help, but this is not an IDE / runner problem. This gets into driver setup and Windows, two areas where I am a very poor resource.

tharfy commented 7 months ago

I had exactly the same problem, on Windows 11, but with the geckodriver. I just made some updates, and hit the same problem : "Driver took too long to build. This is likely an issue with the browser or driver." after 30 seconds. It was working with the exact same version of selenium-side-runner (4.0.5) and geckodriver (4.3.3) downloaded two months ago.

I finally found the culprit : it is Node version 20.12.2 ! With the previous version, v20.12.1, or version v20.11.0 it works again ... Here is the last working version : https://nodejs.org/download/release/v20.12.1

Maybe something linked to this ? https://nodejs.org/en/blog/release/v20.12.2

[69ffc6d50d] - src: disallow direct .bat and .cmd file spawning (Ben Noordhuis)

toddtarsi commented 7 months ago

@tharfy - You are amazing, thank you. Will review tonight.

jackchuong commented 7 months ago

I uninstalled node and npm , reinstall node v19.9.0 and npm 9.6.3 , selenium-side-runner worked.

toddtarsi commented 7 months ago

Thank you again @jackchuong. ๐Ÿ˜ฎโ€๐Ÿ’จ I think I might hold off on fixing this until this weekend. For a number of reasons, I've needed to get a cheapy windows notebook and to iterate this without will probably be a nightmare for Windows users, so I'll get a notebook and do it this weekend.

kaslin commented 4 months ago

This appears to still be an issue in the latest version of Node: 22.4.1. Installing v 19.9.0 fixed the issue for me as well.

toddtarsi commented 4 months ago

@kaslin - Thanks for letting me know about this.

I plan to catch up on issues this weekend, but I can't guarantee I'll get to this yet. It's top of my list though.

captainTycho commented 1 month ago

Hi everyone, I tried your solution using node 19.9.0, but the situation does not change on my side. In my local environment, everything works well despite some slowness since this downgrade. Wouldn't this be an unopened port problem ?

I tried this script in order to open a chrome navigator. node -e "const webdriver = require('selenium-webdriver'); const driver = new webdriver.Builder().withCapabilities({}).forBrowser('chrome').build();" but it returns a timeout error. Error: Timed out waiting for the WebDriver server at http://127.0.0.1:35647/ (the port number change at each time)