SeleniumHQ / selenium

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

[🐛 Bug]: Server has not been started. #14188

Closed ejuniorDGT closed 4 days ago

ejuniorDGT commented 4 days ago

What happened?

Hi, I’m trying to solve a problem. I need to get the address where it is running, but when I try to access, it gives error: Server has not been started.

How can we reproduce the issue?

const { Builder } = require('selenium-webdriver')
const chrome = require('selenium-webdriver/chrome')

class WebDriver {
    build() {
        const driver = new Builder().forBrowser('chrome').build()
        driver.get('https://www.google.com/')
        console.log(chrome.Driver.getDefaultService().address())
    }
}

new WebDriver().build()

Relevant log output

Error: Server has not been started.
    at DriverService.address (/node_modules/selenium-webdriver/remote/index.js:185:11)
    at WebDriver.build (/index.js:8:55)
    at Object.<anonymous> (/index.js:12:17)
    at Module._compile (node:internal/modules/cjs/loader:1358:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
    at Module.load (node:internal/modules/cjs/loader:1208:32)
    at Module._load (node:internal/modules/cjs/loader:1024:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
    at node:internal/main/run_main_module:28:49

Operating System

Ubuntu

Selenium version

NodeJS (20.15.0) and Selenium (4.22.0)

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

Versão 126.0.6478.114 64 bits

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

ChromeDriver 126.0.6478.63

Are you using Selenium Grid?

4.22.0

github-actions[bot] commented 4 days ago

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

titusfortner commented 4 days ago

This is referencing a new service, not the existing service. I don't know the JS code well enough off hand, I'll add links below for how to get more help.

github-actions[bot] commented 4 days ago

💬 Please ask questions at:

ejuniorDGT commented 4 days ago

@titusfortner , I’m facing a problem, but I don’t know what it is.

In version 4.22.0 Chrome.Driver.getDefaultService(). address() returns null.

In version 3.6.0 Chrome.getDefaultService(). address() returns a Promise.

I found nothing like it in forums.

titusfortner commented 4 days ago

I don't know the JS code well enough. @harsha509 do you know the answer to this?