1

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 passes 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 will 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("pcgeckodriver"));
                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("macgeckodriver"));
                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 weburl = ReadProperties.globalProp.getProperty("weburl");
                this.driverThread.get().get(weburl);
                this.driverThread.get().manage().window().maximize(); 


    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
<suite name="XOME Suite" parallel="tests" verbose="1" thread-count="2">

<test name = "Mac Firefox Tests" preserve-order="true" group-by-instances="true">
<parameter name="browser" value="macfirefox">
    <classes>
        <class name="webTests.FilterMoreResultsByKeyword" />
        <class name="webTests.FilterMoreResultsByYear" />
    </classes>
</parameter>
</test>



<test name = "Win Firefox Tests" preserve-order="true" group-by-instances="true">
<parameter name="browser" value="winfirefox">
    <classes>
        <class name="webTests.FilterMoreResultsByKeyword" />
        <class name="webTests.FilterMoreResultsByYear" />
    </classes>
</parameter>
</test>
4
  • Given most mac users user chrome, else safari, I would limit time spent on this. Feels like the < 1% group, if even that. Commented Apr 22, 2019 at 23:46
  • However I also note that "Never will both 2 firefox mac tests and 2 firefox windows tests will pass at the same time" does not sound like a browser problem. What if you don't have the mac-firefox tests but up the number for the other two browsers? Do you still see issues? Commented Apr 22, 2019 at 23:46
  • Currently my tests have not been updated to run on safari, ie, and edge yet though I have set that up in the selenium grid for the future. The only browsers the tests passes on are chrome and firefox, which were the browsers the tests were specifically written for. I would like to get selenium grid to be able to run and pass all the tests on both browsers before proceeding to enhancing it for the other Safari, IE, and Edge browsers. But I'm not sure if it I'm missing something in my setup, or written something wrong, or is it a bug. Thanks. Commented Apr 23, 2019 at 0:09
  • Sure. My main point is Firefox for Mac? Who uses that? Why spend time on something if it's not used? Spend time where more value can be added is my advice. I would turn to browser stats (yours preferably) to determine what browsers to support on what OS for what versions of both Commented Apr 23, 2019 at 0:47

2 Answers 2

0

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 Files\Mozilla Firefox\firefox.exe"); macfirefoxOptions.setBinary("/Applications/Firefox.app/Contents/MacOS/firefox-bin");

0

If I understand this correctly your issues were caused by the configuration of your driver paths.

There is a library called webdrivermanager that will handle the configuration of binarys in your project. I use it in all my projects now and it really helped cut out any webdriver environment configuration issues

https://github.com/bonigarcia/webdrivermanager

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.