Package org.testcontainers.containers
Class BrowserWebDriverContainer<SELF extends BrowserWebDriverContainer<SELF>>
java.lang.Object
org.testcontainers.containers.FailureDetectingExternalResource
org.testcontainers.containers.GenericContainer<SELF>
org.testcontainers.containers.BrowserWebDriverContainer<SELF>
- All Implemented Interfaces:
AutoCloseable,org.junit.rules.TestRule,org.testcontainers.containers.Container<SELF>,org.testcontainers.containers.ContainerState,org.testcontainers.containers.traits.LinkableContainer,org.testcontainers.containers.wait.strategy.WaitStrategyTarget,org.testcontainers.lifecycle.Startable,org.testcontainers.lifecycle.TestLifecycleAware
public class BrowserWebDriverContainer<SELF extends BrowserWebDriverContainer<SELF>>
extends org.testcontainers.containers.GenericContainer<SELF>
implements org.testcontainers.containers.traits.LinkableContainer, org.testcontainers.lifecycle.TestLifecycleAware
A chrome/firefox/custom container based on SeleniumHQ's standalone container sets.
Supported images: selenium/standalone-chrome, selenium/standalone-firefox,
selenium/standalone-edge, selenium/standalone-chrome-debug, selenium/standalone-firefox-debug
Exposed ports: 4444
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.testcontainers.containers.Container
org.testcontainers.containers.Container.ExecResult -
Field Summary
Fields inherited from class org.testcontainers.containers.GenericContainer
CONTAINER_RUNNING_TIMEOUT_SEC, dependencies, dockerClient, INTERNAL_HOST_HOSTNAME, waitStrategyFields inherited from interface org.testcontainers.containers.ContainerState
STATE_HEALTHY -
Constructor Summary
ConstructorsConstructorDescriptionBrowserWebDriverContainer(String dockerImageName) Constructor taking a specific webdriver container name and tagBrowserWebDriverContainer(org.testcontainers.utility.DockerImageName dockerImageName) Constructor taking a specific webdriver container name and tag -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected voidprotected voidcontainerIsStarted(com.github.dockerjava.api.command.InspectContainerResponse containerInfo) static StringgetDockerImageForCapabilities(org.openqa.selenium.Capabilities capabilities, String seleniumVersion) Deprecated.note that this method is deprecated and may be removed in the future.Deprecated.intgetPort()Deprecated.org.openqa.selenium.remote.RemoteWebDriverDeprecated.usegetSeleniumAddress()insteadvoidstop()withCapabilities(org.openqa.selenium.Capabilities capabilities) withDesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities capabilities) Deprecated.Use withCapabilities(Capabilities capabilities) instead: withCapabilities(new FirefoxOptions())withLinkToContainer(org.testcontainers.containers.traits.LinkableContainer otherContainer, String alias) Deprecated.Links are deprecated (see #465).withRecordingFileFactory(RecordingFileFactory recordingFileFactory) withRecordingMode(BrowserWebDriverContainer.VncRecordingMode recordingMode, File vncRecordingDirectory) withRecordingMode(BrowserWebDriverContainer.VncRecordingMode recordingMode, File vncRecordingDirectory, org.testcontainers.containers.VncRecordingContainer.VncRecordingFormat recordingFormat) Methods inherited from class org.testcontainers.containers.GenericContainer
addEnv, addExposedPort, addExposedPorts, addFileSystemBind, addFixedExposedPort, addFixedExposedPort, addLink, apply, canBeReused, containerIsCreated, containerIsStarted, containerIsStarting, containerIsStarting, containerIsStopped, containerIsStopping, copyFileFromContainer, createVolumeDirectory, dependsOn, dependsOn, dependsOn, doStart, equals, failed, finished, getBinds, getCommandParts, getContainerId, getContainerInfo, getContainerName, getCopyToFileContainerPathMap, getCreateContainerCmdModifiers, getDependencies, getDockerClient, getDockerImageName, getEnv, getEnvMap, getExposedPorts, getExtraHosts, getImage, getIpAddress, getLabels, getLinkedContainers, getLivenessCheckPort, getLivenessCheckPortNumbers, getLogConsumers, getNetwork, getNetworkAliases, getNetworkMode, getPortBindings, getShmSize, getStartupAttempts, getStartupCheckStrategy, getTestHostIpAddress, getTmpFsMapping, getVolumesFroms, getWaitStrategy, getWorkingDirectory, hashCode, isHostAccessible, isPrivilegedMode, isShouldBeReused, logger, setBinds, setCommand, setCommand, setCommandParts, setContainerDef, setCopyToFileContainerPathMap, setDockerImageName, setEnv, setExposedPorts, setExtraHosts, setHostAccessible, setImage, setLabels, setLinkedContainers, setLogConsumers, setNetwork, setNetworkAliases, setNetworkMode, setPortBindings, setPrivilegedMode, setShmSize, setStartupAttempts, setStartupCheckStrategy, setTmpFsMapping, setVolumesFroms, setWaitStrategy, setWorkingDirectory, start, starting, succeeded, toString, waitingFor, waitUntilContainerStarted, withAccessToHost, withClasspathResourceMapping, withClasspathResourceMapping, withCommand, withCommand, withCopyFileToContainer, withCopyToContainer, withCreateContainerCmdModifier, withEnv, withEnv, withExposedPorts, withExtraHost, withFileSystemBind, withImagePullPolicy, withLabel, withLabels, withLogConsumer, withMinimumRunningDuration, withNetwork, withNetworkAliases, withNetworkMode, withPrivilegedMode, withReuse, withSharedMemorySize, withStartupAttempts, withStartupCheckStrategy, withStartupTimeout, withTmpFs, withVolumesFrom, withWorkingDirectoryMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.testcontainers.containers.Container
addFileSystemBind, followOutput, followOutput, self, withEnv, withFileSystemBindMethods inherited from interface org.testcontainers.containers.ContainerState
copyFileFromContainer, copyFileToContainer, copyFileToContainer, execInContainer, execInContainer, execInContainer, execInContainer, execInContainerWithUser, execInContainerWithUser, getBoundPortNumbers, getContainerIpAddress, getCurrentContainerInfo, getFirstMappedPort, getHost, getLogs, getLogs, getMappedPort, isCreated, isHealthy, isRunningMethods inherited from interface org.testcontainers.containers.traits.LinkableContainer
getContainerNameMethods inherited from interface org.testcontainers.lifecycle.Startable
closeMethods inherited from interface org.testcontainers.lifecycle.TestLifecycleAware
beforeTest
-
Constructor Details
-
BrowserWebDriverContainer
public BrowserWebDriverContainer() -
BrowserWebDriverContainer
Constructor taking a specific webdriver container name and tag- Parameters:
dockerImageName- Name of the selenium docker image
-
BrowserWebDriverContainer
public BrowserWebDriverContainer(org.testcontainers.utility.DockerImageName dockerImageName) Constructor taking a specific webdriver container name and tag- Parameters:
dockerImageName- Name of the selenium docker image
-
-
Method Details
-
withCapabilities
-
withDesiredCapabilities
@Deprecated public SELF withDesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities capabilities) Deprecated.Use withCapabilities(Capabilities capabilities) instead: withCapabilities(new FirefoxOptions())- Parameters:
capabilities- DesiredCapabilities- Returns:
- SELF
-
getLivenessCheckPorts
- Overrides:
getLivenessCheckPortsin classorg.testcontainers.containers.GenericContainer<SELF extends BrowserWebDriverContainer<SELF>>
-
configure
protected void configure()- Overrides:
configurein classorg.testcontainers.containers.GenericContainer<SELF extends BrowserWebDriverContainer<SELF>>
-
getDockerImageForCapabilities
@Deprecated public static String getDockerImageForCapabilities(org.openqa.selenium.Capabilities capabilities, String seleniumVersion) Deprecated.note that this method is deprecated and may be removed in the future. The no-argsBrowserWebDriverContainer()combined with thewithCapabilities(Capabilities)method should be considered. A decision on removal of this deprecated method will be taken at a future date.- Parameters:
capabilities- aCapabilitiesobject for either Chrome or FirefoxseleniumVersion- the version of selenium in use- Returns:
- an image name for the default standalone Docker image for the appropriate browser
-
getSeleniumAddress
-
getVncAddress
-
getPassword
Deprecated. -
getPort
Deprecated. -
containerIsStarted
protected void containerIsStarted(com.github.dockerjava.api.command.InspectContainerResponse containerInfo) - Overrides:
containerIsStartedin classorg.testcontainers.containers.GenericContainer<SELF extends BrowserWebDriverContainer<SELF>>
-
getWebDriver
Deprecated.usegetSeleniumAddress()insteadObtain a RemoteWebDriver instance that is bound to an instance of the browser running inside a new container.All containers and drivers will be automatically shut down after the test method finishes (if used as a @Rule) or the test class (if used as a @ClassRule)
- Returns:
- a new Remote Web Driver instance
-
afterTest
public void afterTest(org.testcontainers.lifecycle.TestDescription description, Optional<Throwable> throwable) - Specified by:
afterTestin interfaceorg.testcontainers.lifecycle.TestLifecycleAware
-
stop
public void stop()- Specified by:
stopin interfaceorg.testcontainers.lifecycle.Startable- Overrides:
stopin classorg.testcontainers.containers.GenericContainer<SELF extends BrowserWebDriverContainer<SELF>>
-
withLinkToContainer
@Deprecated public SELF withLinkToContainer(org.testcontainers.containers.traits.LinkableContainer otherContainer, String alias) Deprecated.Links are deprecated (see #465). Please useNetworkfeatures instead.Remember any other containers this needs to link to. We have to pass these down to the container so that the other containers will be initialized before linking occurs.- Parameters:
otherContainer- the container rule to link toalias- the alias (hostname) that this other container should be referred to by- Returns:
- this
-
withRecordingMode
public SELF withRecordingMode(BrowserWebDriverContainer.VncRecordingMode recordingMode, File vncRecordingDirectory) -
withRecordingMode
public SELF withRecordingMode(BrowserWebDriverContainer.VncRecordingMode recordingMode, File vncRecordingDirectory, org.testcontainers.containers.VncRecordingContainer.VncRecordingFormat recordingFormat) -
withRecordingFileFactory
-