docker-compose.yml
version: "3"
services:
hub:
image: selenium/hub:3.141.59
ports:
- "4444:4444"
chrome:
image: selenium/node-chrome:3.141.59
depends_on:
- hub
environment:
- HUB_HOST=hub
firefox:
image: selenium/node-firefox:3.141.59
depends_on:
- hub
environment:
- HUB_HOST=hub
Note:
i have already pulled images
docker-compose up
launch in browser';
http://192.168.99.100:4444/grid/console
docker-compose up --scale chrome=4
sample Program:
public class GridTest {
@Test
public static void main(String[] args) throws MalformedURLException, InterruptedException {
DesiredCapabilities dc = new DesiredCapabilities();
// WebDriver driver;
//Thread.sleep(20000);
dc.setBrowserName("chrome");
dc.setPlatform(Platform.LINUX);
WebDriver driver = new RemoteWebDriver(new URL("http://192.168.99.100:4444/wd/hub"), dc);
//Thread.sleep(20000);
driver.manage().window().maximize();
driver.get("http://google.com");
//Thread.sleep(20000);
driver.close();
}
}
Next Step: Lets try to integrate with jenkins.
No comments:
Post a Comment