Search code examples
seleniumdockerselenium-gridzalenium

How can I run tests in Zalenium from Windows?


I want to run my tests on Zalenium. I am using Win10 pro 64bit. I start zalenium with:

docker run --rm -ti --name zalenium -p 4444:4444 -v /var/run/docker.sock:/var/run/docker.sock -v /d/zalenium/videos:/home/seluser/videos --privileged dosel/zalenium start

My driver setup from code:

    public WebDriver createDriver() throws MalformedURLException {
    DesiredCapabilities cap = new DesiredCapabilities();

    if ("chrome".equals(browser.toLowerCase())){
        cap.setBrowserName(BrowserType.CHROME);
    }else if("firefox".equals(browser.toLowerCase())){
        cap.setBrowserName(BrowserType.FIREFOX);
    }
    return new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), cap);
}

However, when I run the tests, I get this error:

org.openqa.selenium.WebDriverException: Error forwarding the new session Empty pool of VM for setup Capabilities {browserName: chrome}

What am i doing wrong?


Solution

  • I found the issue. Changing localhost to your ip address works.

    return new RemoteWebDriver(new URL("http://yourip:4444/wd/hub"), cap);