Docker selenium Integration
Run the selenium scripts in docker container
Run selenium Scripts in selenium grid 4.x
How to run the selenium scripts in docker container
Working with selenium stand alone
Running the scripts in
Selenium/standalone-chrome
Selenium/standalone-firefox
Selenium/standalone-edge
Download the image from docker hub
docker pull selenium/standalone-chrome:latest
docker pull selenium/standalone-firefox:latest
docker pull selenium/standalone-edge:latest
Create container from the image / options to create the container by running the image
docker run -d -p 4444:4444 --shm-size="2g" selenium/standalone-chrome
-d: to run the selenium stand alone in background
-p: is the port first 4444 is the localhost port number and second 4444 is the selenium/standalone-chrome port number
--shm-size=2g is to use the host's shared memory
Designing the selenium scripts
package SeleniumStandaloneInDocker;
import java.net.URL;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.RemoteWebDriver;
public class DockerWithChrome {
public static void main(String[] args) throws Exception {
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.setCapability("platform", Platform.ANY);
WebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444"), chromeOptions);
driver.get("https://www.google.com/");
System.out.println("Title is:" + driver.getTitle());
driver.quit();
}
}
Run the selenium script in docker
#QA Automation Classes
#qaautomationclasses
#QAAUTOMATIONCLASSES
#qa automation classes
Watch video Docker selenium Integration | Run Selenium scripts in docker container| Selenium 4.x Grid in docker online without registration, duration hours minute second in high quality. This video was added by user QA Automation Classes 06 November 2021, don't forget to share it with your friends and acquaintances, it has been viewed on our site 566 once and liked it 21 people.