seleniumselenium-webdriverprotractorselenium-gridselenium-grid2

How to run test on specific browser by selenium grid


I have register two platform with chrome browser on windows 7 and windows 10 into selenium grid server.

I want to run a test at Chrome browser on Windows 10 but when i run the test, the test randomly run on Windows 7 and randomly run on Windows 10 on chrome.

Do you have an idea how to do the configuration to run the test on specific browser and platform when we have registered multiple platform?

hub:

java -jar selenium-server-standalone-3.7.1.jar -role hub

register node on windows 7:

java -Dwebdriver.chrome.driver=chromedriver_2.33.exe -jar selenium-server-standalone-3.7.1.jar -role node -hub http://localhost:4444

register node on windows 10:

java -Dwebdriver.chrome.driver=chromedriver_2.33.exe -jar selenium-server-standalone-3.7.1.jar -role node -hub http://localhost:4444

protractor.conf.js

exports.config = {

    specs: [
        '**/*.mytest.e2e-spec.ts'
    ],
    multiCapabilities: [
        {
            browserName: 'chrome',
            platform: 'WIN10',
        }
    ],
    seleniumAddress: 'http://localhost:4444/wd/hub',
    baseUrl: 'http://localhost:4200/',
    framework: 'jasmine',
    jasmineNodeOpts: {
        print: function () {
        }
    },
    onPrepare: function () {
        require('ts-node').register({
            project: 'e2e/tsconfig.e2e.json'
        });
    }
};

Solution

  • I would suggest that you do the following

    Now based on the PLATFORM capabilities specified by your test, it would be routed to the appropriate node.