Docker Community Forums

Share and learn in the Docker community.

Unable to launch a chrome browser using selenium grid with docker

dockerhub
docker

(Sivazcse) #1

Hi,
I am using ubuntu machine with docker installed. Refer my version

Client:
Version: 17.12.0-ce
API version: 1.35
Go version: go1.9.2
Git commit: c97c6d6
Built: Wed Dec 27 20:10:36 2017
OS/Arch: linux/amd64

Server:
Engine:
Version: 17.12.0-ce
API version: 1.35 (minimum version 1.12)
Go version: go1.9.2
Git commit: c97c6d6
Built: Wed Dec 27 20:09:12 2017
OS/Arch: linux/amd64
Experimental: false

Steps were i used:

Created the docker hub using ubuntu terminal
docker run -d -P --name selenium-hub selenium/hub

Connect chrome node to my hub
docker run -d --link selenium-hub:hub selenium/node-chrome

My code: (TestExample.java)

public class TestExample {
	public WebDriver driver;
	@BeforeTest
	public void run() throws InterruptedException, MalformedURLException
	{
		DesiredCapabilities cap = DesiredCapabilities.chrome();
		cap.setCapability("version", "");
		cap.setCapability("platform","LINUX");
		driver = new RemoteWebDriver(new URL("http://localhost:32768/wd/hub"),cap);
		driver.get("https://sta-portal.quixxi.com");
		Thread.sleep(8000);
		System.out.println("test finish");
	}

TestNG XML file (testng.xml)

<?xml version="1.0" encoding="UTF-8"?>
<suite name ="Suite">
<test name ="FirefoxTest">
<classes>
		<class name ="docker.docker_selenium.TestExample"></class>
</classes>
</test>
</suite>

Now I am trying to connect my java code to selenium hub. It was connected and session is executed. I can able to see results through docker console in browser . And also test cases are executed

But unable to launch browser GUI . I can’t able to find what is the mistake. Any one help me to proceed further process


(Rbhavsar21) #2

I am also facing this issue !!


(Inspectorgadgets) #3

I am also facing this issue !!!