-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
What happened?
When trying to run selenium test case on jenkins using selenium stand alone chrome image, i get this error
WebDriverError: unknown error: net::ERR_NAME_NOT_RESOLVED
(Session info: chrome=120.0.6099.224)
at Object.throwDecodedError (node_modules/selenium-webdriver/lib/error.js:524:15)
at parseHttpResponse (node_modules/selenium-webdriver/lib/http.js:601:13)
at Executor.execute (node_modules/selenium-webdriver/lib/http.js:529:28)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async thenableWebDriverProxy.execute (node_modules/selenium-webdriver/lib/webdriver.js:745:17)
I'm using node js and a windows machine with a linux agent in jenkins.
I have specified the URL in code as well.
Command used to start Selenium Grid with Docker (or Kubernetes)
command used:
sh 'docker run -d -p 4444:4444 --shm-size="2g" -e PROXY_SETTINGS="${PROXY_SETTINGS}" selenium/standalone-chrome:4.17.0-20240123'
environment set up in pipeline script:
environment {
npm_config_cache='npm-cache'
PROXY_SETTINGS = '''
https_proxy=http://sub.proxy.company.com:1234
HTTPS_PROXY=http://sub.proxy.company.com:1234
'''
}
Javascript code:
const loggingPrefs = new Preferences();
loggingPrefs.setLevel(logging.Type.BROWSER, logging.Level.ALL);
const options = new chrome.Options();
options.setLoggingPrefs({ performance: 'ALL' });
options.addArguments("--incognito");
const caps = Capabilities.chrome();
caps.setLoggingPrefs(loggingPrefs);
driver = new Builder().withCapabilities(Capabilities.chrome())
.setChromeOptions(options.addArguments('--headless=new'))
.usingServer('http://localhost:4444/wd/hub')
.build();
// setting values for prod and preprod urls
const prodUrl = process.env.npm_package_config_prod;
const preprodUrl = process.env.npm_package_config_preprod;
//Now we check if uatURL is defined and uat is being passed in command line like --uat
if (preprodUrl && process.argv.includes('--preprod')) {
console.log("opening e-tst3 URL");
await driver.get(preprodUrl);
} else if (prodUrl && process.argv.includes('--prod')) {
console.log("Trying the PROD version");
await driver.get('https://www.google.com/');
} else {
console.log("None of the environments worked! :(");
};
It throws the error at the 'driver.get'
I have tried to change the URL to without "www" still no luck.
Relevant log output
WebDriverError: unknown error: net::ERR_NAME_NOT_RESOLVED
(Session info: chrome=120.0.6099.224)
at Object.throwDecodedError (node_modules/selenium-webdriver/lib/error.js:524:15)
at parseHttpResponse (node_modules/selenium-webdriver/lib/http.js:601:13)
at Executor.execute (node_modules/selenium-webdriver/lib/http.js:529:28)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async thenableWebDriverProxy.execute (node_modules/selenium-webdriver/lib/webdriver.js:745:17)
Operating System
windows 11 but linux agent on jenkins
Docker Selenium version (image tag)
4.17
Selenium Grid chart version (chart version)
No response