module-webdriver icon indicating copy to clipboard operation
module-webdriver copied to clipboard

Setting custom capabilities for matching specific Nodes

Open Omoalfa opened this issue 1 year ago • 0 comments

So I am try to set up custom capabilities for matching specific nodes but I keep getting this error:

Driver initiation:  SessionNotCreatedError: Could not start a new session. Could not start a new session. Error while creating session with the driver service. Stopping driver service: Could not start a new session. Response code 500. Message: session not created: Chrome failed to start: exited normally.
  (session not created: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /opt/google/chrome/chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.) 
Host info: host: 'd86e3f5d6ac3', ip: '172.17.0.2'
Build info: version: '4.23.0', revision: '77010cd'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.4.0-122-generic', java.version: '17.0.11'
Driver info: driver.version: unknown
Build info: version: '4.23.0', revision: '77010cd'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.4.0-122-generic', java.version: '17.0.11'
Driver info: driver.version: unknown
Build info: version: '4.23.0', revision: '77010cd'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '6.8.0-36-generic', java.version: '17.0.11'
Driver info: driver.version: unknown
    at Object.throwDecodedError (/home/omoalfa/Desktop/Omoalfa/Node/cloud-runner/node_modules/selenium-webdriver/lib/error.js:521:15)
    at parseHttpResponse (/home/omoalfa/Desktop/Omoalfa/Node/cloud-runner/node_modules/selenium-webdriver/lib/http.js:510:13)
    at Executor.execute (/home/omoalfa/Desktop/Omoalfa/Node/cloud-runner/node_modules/selenium-webdriver/lib/http.js:443:28)
    at processTicksAndRejections (node:internal/process/task_queues:95:5) {
  remoteStacktrace: ''
}

I am following the instructions here this is how I initiated the browser node using docker: docker run -d -p 5555:5555 -e SE_EVENT_BUS_HOST=<hub_server_ip> -e SE_EVENT_BUS_PUBLISH_PORT=4442 -e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 -e SE_NODE_HOST=<node_server_ip> -e SE_NODE_STEREOTYPE='{ "browserName":"chrome","browserVersion":"120.0","platformName": "linux", "app:project_id": "9a920fb9-cebe-4ef7-8e2d-9b6fbd78f2cd" }' selenium/node-chrome:120.0

and then tried creating a session in my code using the following step:

const options = new chrome.Options();
        
                options.addArguments('--start-maximized');

                options.addArguments('--ignore-certificate-errors');
                
                options.excludeSwitches('enable-logging');
                options.setLoggingPrefs({ browser: 'ALL' });
                options.setBrowserVersion("120.0")
                options.setPlatform("linux")

                capabilities = Capabilities.chrome();
                capabilities.set("se:name", name);
                capabilities.set("app:project_id", "9a920fb9-cebe-4ef7-8e2d-9b6fbd78f2cd")
                capabilities.setAcceptInsecureCerts(true);

                driver = await new Builder().forBrowser(Browser.CHROME).setChromeOptions(options).withCapabilities(capabilities).usingServer(hubServer).build();

Is there a bug somewhere or is there something I am doing wrong?

Omoalfa avatar Aug 02 '24 18:08 Omoalfa