What should be done if we receive the message - unable to find a matching set of capabilities

358    Asked by AndreaBailey in QA Testing , Asked on Apr 29, 2022

 I'm running 2 firefox windows tests, 2 firefox mac tests, 2 chrome windows tests, and 2 chrome mac tests in parallel on both a windows node and a mac node. All tests passed except the 2 firefox mac tests. Sometimes 2 firefox mac tests will pass, but the 2 firefox windows tests would fail. Never will both 2 firefox mac tests and 2 firefox windows tests pass at the same time. I am using the latest firefox driver, latest firefox browser version, latest selenium webdriver, and latest java 8 jdk.


 testbase file

 if(browser.contains("winfirefox"))
            {
                System.setProperty("webdriver.gecko.driver", ReadProperties.globalProp.getProperty("pc geckodriver"));
                FirefoxOptions firefoxOptions = new FirefoxOptions();
                firefoxOptions.setCapability("platform", "WINDOWS");
                firefoxOptions.setCapability("browser", "firefox");
                firefoxOptions.setCapability("newCommandTimeout", 5000);
                firefoxOptions.setCapability(FirefoxDriver.MARIONETTE, true);
                whichNodeURL=winNodeURL;    
                try
                {
                    driverThread.set(new RemoteWebDriver(new URL(whichNodeURL), firefoxOptions));
                } catch (MalformedURLException e) {
                    e.printStackTrace();
                }
            }
    else if(browser.contains("macfirefox"))
            {
                System.setProperty("webdriver.gecko.driver", ReadProperties.globalProp.getProperty("mac geckodriver"));
                FirefoxOptions macfirefoxOptions = new FirefoxOptions();
                macfirefoxOptions.setCapability("platform", "MAC");
                macfirefoxOptions.setCapability("browser", "firefox");
                macfirefoxOptions.setCapability("newCommandTimeout", 5000);
                macfirefoxOptions.setCapability(FirefoxDriver.MARIONETTE, true);
                whichNodeURL=macNodeURL;
                try
                {
                    driverThread.set(new RemoteWebDriver(new URL(whichNodeURL), macfirefoxOptions));
                } catch (MalformedURLException e) {
                    e.printStackTrace();
                }
            }
                String web url = ReadProperties.globalProp.getProperty("weburl");
                this.driverThread.get().get(weburl);
                this.driverThread.get().manage().window().maximise(); 
    mac node json file
     {
                     "capabilities":
                       [
                {
                       "browserName": "firefox",
                       "marionette": true,
                       "maxInstances": 2,
                      "browser-version": "66.0.3",
                      "platform": "MAC",
                     "seleniumProtocol": "WebDriver"
                },
               {
                     "browserName": "chrome",
                     "maxInstances": 2,
                    "browser-version": "73.0.3683",
                    "platform": "MAC",
                    "seleniumProtocol": "WebDriver"
               },
               {
                     "browserName": "safari",
                      "technologyPreview": false,
                      "platform": "MAC",
                      "maxInstances": 1,
                     "seleniumProtocol": "WebDriver"
                    }
                 ],
              "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
              "maxSession": 2,
              "port": 5555,
              "register": true,
              "registerCycle": 5000,
              "hub": "http://xxxxxxx:4444",
             "nodeStatusCheckTimeout": 5000,
             "nodePolling": 5000,
             "role": "node",
             "cleanUpCycle": 5000,
             "timeout": 5000,
             "unregisterIfStillDownAfter": 60000,
            "downPollingLimit": 2,
            "debug": false,
            "servlets" : [],
           "withoutServlets": [],
           "custom": {}
            }
TESTNG FILE



    
        
        
    




    
        
        
    


selenium-webdriver
selenium-grid
Answered by ananya Pawar

If you are unable to find a matching set of capabilities -


By adding the binary path of Firefox browser and also adding the path of all the browser drivers to the path variable in environment variables in windows this error is no longer seen. On mac add browser driver path with these instructions. Easiest way is to create one folder to store all browser drivers and provide that single path. 1. Open up Terminal 2. Run sudo nano /etc/paths 3. Enter your password 4. Go to the bottom of the file and enter the path you wish to add 5. My PATH looks like: /Users/name/Documents/WebDriver 6. Control-x to quit 7. Y to save 8. Press enter to confirm Closing issue. firefoxOptions.setBinary("C:Program FilesMozilla Firefox irefox.exe"); macfirefoxOptions.setBinary("/Applications/Firefox.app/Contents/MacOS/firefox-bin");



Your Answer

Interviews

Parent Categories