Selenium Grid not detecting integrated in Docker yaml file

30 views Asked by At

I am trying to build a automation testing project for my portfolio. But I am facing issue regarding the same. I have created a Docker YAML file to wrote configurations to run execution on chrome and firefox browser. below is the screenshot of YAML file

enter image description here

Also I have create a class for invoking execution as per the POM file which I call as abstract test file.

public abstract class AbstractTest {
    protected WebDriver driver;

    @BeforeTest
    public void setDriver() {
        if(Boolean.getBoolean("selenium.grid.enabled"))
        {
            try {
                this.driver = getRemoteDriver();
            } catch (MalformedURLException e) {
                e.printStackTrace();
            }
        } else {
            this.driver = getLocalDriver();
        }
    }

    @SuppressWarnings("deprecation")
    private WebDriver getRemoteDriver() throws MalformedURLException {
        Capabilities capabilities;
        if(System.getProperty("browser").equalsIgnoreCase("chrome"))
        {
            capabilities = new ChromeOptions();
        } else {
            capabilities = new FirefoxOptions();
        }
        return new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capabilities);
    }

    private WebDriver getLocalDriver() {
        WebDriverManager.chromedriver().setup();
        return new ChromeDriver();
    }

    @AfterTest
    public void quitDriver() {
        this.driver.quit();
    }
}

even after passing selenium.grid.enabled as TRUE in POM.xml file my execution is running locally. I have attached POM.xml screenshot.

enter image description here

There is nothing running in selenium grid. Can anyone help please.

0

There are 0 answers