Reputation: 21
Following is my Dockerfile which is in ubi8
FROM registry-access-redhat-com.repo.cci.company.net/ubi8/ubi-minimal
RUN rm -f /etc/yum.repos.d/redhat.repo && \
sed -i 's#cdn-ubi.redhat.com/content/public/ubi#repo.cci.company.net/cdn-ubi-redhat-com#' /etc/yum.repos.d/ubi.repo
ADD repos/rpm.repo /etc/yum.repos.d/
#CUSTOM ARGS FOR BUILDING IMAGE
ARG REPO_HTTPS_URL
ARG external_requirements_repo=$REPO_HTTPS_URL/api/pypi/python/simple
ARG requirements_repo=$REPO_HTTPS_URL/api/pypi/pypi-dependencies/simple
ARG internal_requirements_repo=$REPO_HTTPS_URL/pypi-candidates-local/
ARG py_candidates_repo=$REPO_HTTPS_URL/api/pypi/pypi-candidates/simple
ARG rbac_repo=$REPO_HTTPS_URL/dsrbac-pypi-releases
ARG CHROME_VERSION=133.0.6943.98
ENV CHROME_BIN=/opt/google/chrome/chrome \
CHROMEDRIVER_HOME=/opt/chromedriver \
CHROMEDRIVER=/opt/chromedriver/chromedriver \
JMETER_HOME=/opt/jmeter/apache-jmeter-5.6.3
RUN microdnf install shadow-utils wget gzip zip unzip xz tcl tk openblas gcc libxslt libstdc++ util-linux librdkafka librdkafka-devel vulkan alsa-lib libappindicator-gtk3 libXScrnSaver libXcomposite libXcursor libXdamage libXext libXfixes libXi libXrandr libXtst libdrm liberation-fonts libgbm xdg-utils java-17-openjdk openssl-1.1.1k-12.el8_9.x86_64 Python-3.11.7-1.el8.x86_64 vi \
&& microdnf clean all \
&& cd /root && wget -q "https://repo.cci.company.net/eu_apache_org_dist/jmeter/binaries/apache-jmeter-5.6.3.zip" \
&& unzip apache-jmeter-5.6.3.zip -d /opt/jmeter && rm -f apache-jmeter-5.6.3.zip \
&& wget https://repo.cci.company.net/google-chrome-rpm-remote/x86_64/google-chrome-stable-${CHROME_VERSION}-1.x86_64.rpm && rpm -Uvh google-chrome-stable-${CHROME_VERSION}-1.x86_64.rpm && rm -f google-chrome-stable-${CHROME_VERSION}-1.x86_64.rpm && rm -rf /var/lib/rpm/.rpm.lock \
&& export http_proxy=http://10.144.1.10:8080 && export https_proxy=http://10.144.1.10:8080 \
&& wget -q https://storage.googleapis.com/chrome-for-testing-public/${CHROME_VERSION}/linux64/chromedriver-linux64.zip \
&& unzip -qq -j chromedriver-linux64.zip -d $CHROMEDRIVER_HOME && rm chromedriver-linux64.zip && chmod ugo+rwx $CHROMEDRIVER
RUN ln -s /usr/local/bin/python3.11 /usr/local/bin/python
COPY src ./
COPY pip.conf /etc/pip.conf
RUN ldconfig /usr/local/lib \
&& ldconfig /usr/local/lib \
&& /usr/local/bin/pip3.11 install --no-cache-dir -U virtualenv==20.25.1 setuptools==65.7.0 \
&& export LD_LIBRARY_PATH=/usr/local/lib \
&& /usr/local/bin/pip3.11 install --upgrade --index-url ${external_requirements_repo} -r requirements.txt \
&& /usr/local/bin/pip3.11 install --index-url ${requirements_repo} avro==1.11.3 confluent-kafka==2.3.0 pandas greenlet==3.0.3 locust invokust \
&& /usr/local/bin/pip3.11 install --index-url ${py_candidates_repo} unified_logging==25.3.1.post657 \
&& /usr/local/bin/pip3.11 install -r clients.txt --index-url ${internal_requirements_repo} --extra-index-url ${external_requirements_repo} --extra-index-url ${rbac_repo}\
&& rm -rf /root/.cache /tmp/* \
&& microdnf clean all
# Set the PATH environment variable to include Google Chrome
ENV PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$CHROMEDRIVER_HOME:/opt/google/chrome:$JMETER_HOME/bin"
# Set Other PATH environment variables
ENV PYTHONPATH="$PYTHONPATH:TestSuites/lib"
ENV PYTHONWARNINGS="ignore: Unverified HTTPS request"
requirements.txt content
pip==24.0
requests==2.32.3
cherrypy==18.7.0
pyyaml==6.0.2
numpy==2.1.3
lxml==5.2.1
scipy==1.13.0
robotframework==6.1.1
robotframework-jsonlibrary==0.5
robotframework-requests==0.9.4
robotframework-seleniumlibrary==6.1.1
robotframework-sshlibrary==3.8.0
robotframework-stacktrace==0.4.1
robotframework-excellib==2.0.1
robotframework-stringformat==0.1.8
robotframework-xvfb==1.2.2
selenium==4.28.1
scp==0.15.0
openpyxl==3.1.5
python-pptx==1.0.2
openpyxl-image-loader==1.0.5
asyncio
aiohttp
paramiko
chainmap
xlrd
kubernetes
assertpy
pillow
Xlib
pyautogui
xlsxwriter
My Robotframework file for a simple chrome opening
*** Settings ***
Documentation This page contains operations which are common in nature
Library SeleniumLibrary
Suite Teardown Close All Browsers
*** Variables ***
${URL} https://www.google.co.in/
*** Test Cases ***
Verify Chrome
[Tags] WIP
Chrome Browser setup
*** Keywords ***
Chrome Browser setup
${time}= get time
Log to console Current time at TC start is : ${time}
Close All Browsers
log to console Any previous opened browser if present is closed.
${chrome_options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys, selenium.webdriver
Call Method ${chrome_options} add_argument test-type
Call Method ${chrome_options} add_argument --disable-extensions
Call Method ${chrome_options} add_argument --headless
Call Method ${chrome_options} add_argument --disable-gpu
Call Method ${chrome_options} add_argument --no-sandbox
Call Method ${chrome_options} add_argument --disable-dev-shm-usage
Call Method ${chrome_options} add_argument --ignore-certificate-errors
Call Method ${chrome_options} add_argument --start-maximized
${EXCLUDES} Create list enable-logging
Call Method ${chrome_options} add_experimental_option excludeSwitches ${EXCLUDES}
Create Webdriver Chrome options=${chrome_options}
Open Browser about:about Chrome
#Open Browser ${URL} Chrome
Also tried with:
*** Settings ***
Documentation This page contains operations which are common in nature
Library SeleniumLibrary
Suite Teardown Close All Browsers
*** Variables ***
${URL} https://www.google.co.in/
*** Test Cases ***
Verify Chrome
[Tags] WIP
Chrome Browser setup
*** Keywords ***
Chrome Browser setup
${time}= get time
Log to console Current time at TC start is : ${time}
Close All Browsers
log to console Any previous opened browser if present is closed.
${chrome_options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys, selenium.webdriver
Call Method ${chrome_options} add_argument test-type
Call Method ${chrome_options} add_argument --disable-extensions
Call Method ${chrome_options} add_argument --headless
Call Method ${chrome_options} add_argument --disable-gpu
Call Method ${chrome_options} add_argument --no-sandbox
Call Method ${chrome_options} add_argument --disable-dev-shm-usage
Call Method ${chrome_options} add_argument --ignore-certificate-errors
Call Method ${chrome_options} add_argument --start-maximized
${user_data}= Set Variable --user-data-dir=/tmp/user-data
Call Method ${chrome_options} add_argument ${user_data}
${remote_port}= Set Variable --remote-debugging-port=9222
Call Method ${chrome_options} add_argument ${remote_port}
${EXCLUDES} Create list enable-logging
Call Method ${chrome_options} add_experimental_option excludeSwitches ${EXCLUDES}
Create Webdriver Chrome options=${chrome_options}
Open Browser about:about Chrome
Both are throwing the following issue:
SessionNotCreatedException: Message: session not created: probably user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir
#0 0x555604a21bba <unknown>
#1 0x5556044bf790 <unknown>
#2 0x5556044f8bc5 <unknown>
#3 0x5556044f492f <unknown>
#4 0x555604545369 <unknown>
#5 0x555604544896 <unknown>
#6 0x555604536823 <unknown>
#7 0x555604502a88 <unknown>
#8 0x555604503bf1 <unknown>
#9 0x5556049eb15b <unknown>
#10 0x5556049ef0e2 <unknown>
#11 0x5556049d801c <unknown>
#12 0x5556049efcd4 <unknown>
#13 0x5556049bc48f <unknown>
#14 0x555604a104f8 <unknown>
#15 0x555604a106c9 <unknown>
#16 0x555604a20a36 <unknown>
#17 0x7f33e6f611ca start_thread
Also tried with multiple versions of Selenium, tried downgrading selenium as well. Nothing seem to work.
Upvotes: 0
Views: 47