Parasoft Selenic reduces the complexity associated with Selenium test creation and maintenance. Selenic analyzes Selenium tests at runtime and if a failure is detected due to a bad locator or wait condition, Selenic will repair the locator so that the test can proceed. Selenic will also recommend new locators that the tester can use to fix the test. Selenic recommendations can be loaded directly into the IDE so that developers can readily update their code. Selenic also ships with the Parasoft Recorder, which is an extension for the Chrome browser that enables you to record UI actions and generate pure Selenium tests that leverage the Page Object Model for increased maintainability.
This image is based on Red Hat UBI Linux and includes:
/opt/parasoft/selenic). Parasoft Recorder and IDE integration are not included.false to true in the examples below.To license Selenic, either provide license server information using the environment variables below, or mount a modified selenic.properties at /opt/parasoft/selenic/selenic.properties. Alternatively, for the selenic_analyzer.jar you may specify the path to the selenic.properties file using the -settings command-line argument.
The following command will run the Selenic Analyzer. It also does the following:
docker run \
-e ACCEPT_EULA=false \
-e LICENSE_SERVER_URL=http://my.example.com/licenseserver \
-v ${HOME}/report:/home/parasoft/report \
-v ${HOME}/parasoft/recorded_data:/home/parasoft/parasoft/recorded_data \
-it --rm \
parasoft/selenic \
java -jar selenic_analyzer.jar -report /home/parasoft/report/
The following example will run the Selenic Analyzer on JUnit tests. It also does the following:
docker run \
-e ACCEPT_EULA=false \
-e LICENSE_SERVER_URL=http://my.example.com/licenseserver \
-v ${HOME}/path/to/host/project:/home/parasoft/myproject \
-v ${HOME}/parasoft/recorded_data:/home/parasoft/parasoft/recorded_data \
-it --rm \
parasoft/selenic \
java -javaagent:/opt/parasoft/selenic/selenic_agent.jar=captureDom=true \
-cp /home/parasoft/myproject/lib/*:/home/parasoft/myproject/path/to/folder/containing/test/classes \
org.junit.platform.console.ConsoleLauncher --select-class com.mypackage.MyTestClass
Note To run browser tests within the docker image you will need to create a custom docker image. See the section on how to install Google Chrome for browser playback.
Alternatively, you can copy out the /opt/parasoft/selenic folder from the docker image and run commands on the host machine.
docker run \
--rm \
-v "${HOME}/destination:/home/parasoft/destination" \
-e ACCEPT_EULA=false \
parasoft/selenic \
cp -R /opt/parasoft/selenic /home/parasoft/destination/.
You can customize the Parasoft Selenic image.
This image runs with a pre-defined parasoft user. The user ID and group ID of the parasoft user may not match the user ID and group ID of the user on the host that is attempting to run this image as this can cause problems when mounting directories from the host. Files owned by the user on the host might not be accessible to the parasoft user and vice versa. In particular, the parasoft user may need to read Selenic projects from the host's file system. Similarly, the parasoft user may need to write Selenic report files back to the host's file system. To solve this problem, the user ID and group ID of the parasoft user can be modified to match the user on the host by building a custom image as follows:
FROM parasoft/selenic
# default values, which can be overriden with --build-arg option
ARG HOST_UID=1000
ARG HOST_GID=1000
USER root:root
RUN rm -f /var/log/lastlog /var/log/faillog && \
ln -s /dev/null /var/log/lastlog && \
ln -s /dev/null /var/log/faillog && \
groupmod -g ${HOST_GID} parasoft && \
usermod -u ${HOST_UID} -g ${HOST_GID} parasoft && \
chown -h -R ${HOST_UID}:${HOST_GID} /opt/local/parasoft && \
touch /var/log/lastlog && \
touch /var/log/faillog
USER parasoft:parasoft
Note: lastlog and faillog are "sparse files" that can be very large in total size. Certain commands like usermod touch those files. They are temporarily linked to /dev/null to prevent them from bloating the image.
Docker build command:
docker build --no-cache --tag selenic-$(id -un) --build-arg HOST_UID=$(id -u) --build-arg HOST_GID=$(id -g) .
The following example shows a Dockerfile for building a Selenic image with Gradle:
FROM parasoft/selenic
ARG GRADLE_VERSION=9.2.1
ENV GRADLE_HOME=/opt/gradle
USER root:root
RUN curl -L -o /tmp/gradle.zip https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip && \
mkdir -p ${GRADLE_HOME} && \
unzip -q /tmp/gradle.zip -d /opt && \
mv /opt/gradle-${GRADLE_VERSION}/* ${GRADLE_HOME} && \
rm -rf /opt/gradle-${GRADLE_VERSION} /tmp/gradle.zip
USER parasoft:parasoft
ENV PATH=${GRADLE_HOME}/bin:${PATH}
The following example shows a Dockerfile for building a Selenic image with Maven:
FROM parasoft/selenic
USER root:root
ARG USER_HOME_DIR=/home/parasoft
ARG MAVEN_VERSION=3.9.11
ENV MAVEN_HOME=${USER_HOME_DIR}/apache-maven-${MAVEN_VERSION}
ARG BASE_URL=https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/
RUN mkdir -p ${MAVEN_HOME} && \
curl -L -o /tmp/apache-maven.tar.gz ${BASE_URL}/apache-maven-${MAVEN_VERSION}-bin.tar.gz && \
tar -xzf /tmp/apache-maven.tar.gz -C ${MAVEN_HOME} --strip-components=1 && \
rm -f /tmp/apache-maven.tar.gz && \
ln -s ${MAVEN_HOME}/bin/mvn /usr/bin/mvn
ENV PATH="${MAVEN_HOME}/bin:${PATH}"
USER parasoft:parasoft
ENV MAVEN_CONFIG="${USER_HOME_DIR}/.m2"
Consider mounting a host directory as the .m2 directory. This simplifies configuring the .m2/settings.xml file and allows maven dependencies to persist when starting and stopping Selenic docker containers. For example:
docker run \
-e ACCEPT_EULA=false \
-e LICENSE_SERVER_URL=http://my.example.com/licenseserver \
-v ${HOME}/path/to/mavenproject:/home/parasoft/mavenproject \
-v ${HOME}/.m2:/home/parasoft/.m2 \
-v ${HOME}/parasoft/recorded_data:/home/parasoft/parasoft/recorded_data \
-it --rm \
selenic-chrome \
mvn -f /home/parasoft/mavenproject/pom.xml test -DargLine=-javaagent:/opt/parasoft/selenic/selenic_agent.jar=captureDom=true,selfHealing=true
This image does not contain any web browsers. Google Chrome can be installed to support running Selenium tests in the container.
Dockerfile:
FROM parasoft/selenic
USER root:root
ARG USER_HOME_DIR=/home/parasoft
RUN rpm -ivh \
https://mirror.stream.centos.org/10-stream/BaseOS/x86_64/os/Packages/centos-gpg-keys-10.0-12.el10.noarch.rpm \
https://mirror.stream.centos.org/10-stream/BaseOS/x86_64/os/Packages/centos-stream-repos-10.0-12.el10.noarch.rpm && \
dnf install -y --nodocs --repo baseos --repo appstream \
liberation-fonts \
xdg-utils && \
rpm -evh \
centos-stream-repos \
centos-gpg-keys && \
rpm --import https://dl.google.com/linux/linux_signing_key.pub && \
dnf install -y --nodocs \
https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm && \
dnf clean all && \
rm -rf /var/cache/dnf
USER parasoft:parasoft
Note: Selenic uses Red Hat UBI as its base image. Google Chrome requires a few extra dependencies that are not available in Red Hat UBI. The Dockerfile pulls in the missing dependencies from CentOS Stream.
Docker build command:
docker build --no-cache --tag selenic-chrome .
By default, Google Chrome crashes when run in a Docker container. To prevent this from happening, certain Chrome arguments must be enabled, including the argument to enable headless browser playback. When constructing a ChromeDriver, use a ChromeOptions with at least the following arguments defined:
ChromeOptions options = new ChromeOptions();
options.addArguments("--headless");
options.addArguments("--no-sandbox");
options.addArguments("--disable-dev-shm-usage");
options.addArguments("--disable-gpu");
driver = new ChromeDriver(options);
If modifying the JUnit tests is not feasible or ideal, you can also modify the docker environment to always include these arguments when running Google Chrome. Do this by modifying the custom docker container to launch a wrapper script when running Google Chrome:
google-chrome-wrapper.sh:
#!/usr/bin/env bash
set -e
exec /usr/bin/google-chrome-stable --headless --no-sandbox --disable-dev-shm-usage --disable-gpu "$@"
Dockerfile:
FROM parasoft/selenic
USER root:root
COPY --chmod=775 google-chrome-wrapper.sh /usr/bin/
ARG USER_HOME_DIR=/home/parasoft
RUN rpm -ivh \
https://mirror.stream.centos.org/10-stream/BaseOS/x86_64/os/Packages/centos-gpg-keys-10.0-12.el10.noarch.rpm \
https://mirror.stream.centos.org/10-stream/BaseOS/x86_64/os/Packages/centos-stream-repos-10.0-12.el10.noarch.rpm && \
dnf install -y --nodocs --repo baseos --repo appstream \
liberation-fonts \
xdg-utils && \
rpm -evh \
centos-stream-repos \
centos-gpg-keys && \
rpm --import https://dl.google.com/linux/linux_signing_key.pub && \
dnf install -y --nodocs \
https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm && \
update-alternatives --install /usr/bin/chrome chrome /usr/bin/google-chrome-wrapper.sh 100 && \
update-alternatives --install /usr/bin/google-chrome google-chrome /usr/bin/google-chrome-wrapper.sh 100 && \
update-alternatives --set google-chrome /usr/bin/google-chrome-wrapper.sh && \
dnf clean all && \
rm -rf /var/cache/dnf
USER parasoft:parasoft
You need to view and agree to the Parasoft End User License Agreement (EULA) for the software contained in this image.
As with all Docker images, these likely also contain other software which may be under other licenses. As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within.
Content type
Image
Digest
sha256:73dcd9403…
Size
1.6 GB
Last updated
6 months ago
docker pull parasoft/selenic