Hi tried to run selenium test in docker.
const { Builder, By} = require("selenium-webdriver");
const chrome = require('selenium-webdriver/chrome');
const assert = require('assert')
async function addCadastreTest() {
const options = new chrome.Options()
options.setAcceptInsecureCerts(true)
let driver = await new Builder()
.forBrowser("chrome")
.usingServer('http://localhost:4444/wd/hub')
.setChromeOptions(options)
.build();
await driver.get("http://localhost:3000/");
await driver.findElement(By.id("fit")).click()
assert(await driver.switchTo().alert().getText() == "Quel est le nom de votre commune ?")
{
const alert = await driver.switchTo().alert()
await alert.sendKeys("Lons le Saunier")
await alert.accept()
}
await driver.quit();
}
addCadastreTest();
This is the stacktrace of the error :
mapbox\node_modules\selenium-webdriver\lib\error.js:522
let err = new ctor(data.message)
^
WebDriverError: unknown error: net::ERR_CONNECTION_REFUSED
(Session info: chrome=102.0.5005.61)
at Object.throwDecodedError mapbox\node_modules\selenium-webdriver\lib\error.js:522:15)
at parseHttpResponse (mapbox\node_modules\selenium-webdriver\lib\http.js:549:13)
at Executor.execute (mapbox\node_modules\selenium-webdriver\lib\http.js:475:28)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Object.execute (mapbox\node_modules\selenium-webdriver\lib\webdriver.js:735:17)
at async addCadastreTest (mapbox\test\addCadastre.spec.js:14:5) {
remoteStacktrace:
I'm stuck because i tried to run this test in java with selenium in docker and it work but in JavaScript i get this weird error connection refused. If someone have a thought to solve my problem thank.