How can I allow the Robot Framework test to open a browser on my host machine from within the Podman container?
I have tried doing this but the robot suite fails to open the browser on my host machine.
Version details:- Robot Framework - 7.2.2 Python - 3.12.3
I took the given steps:-
- Create a dockerfile with installed python and robot framework
$ cat Dockerfile
FROM python:3.9
# Set up a working directory
WORKDIR /app
# Upgrade pip
RUN pip install --upgrade pip
# Install Robot Framework and SeleniumLibrary
RUN pip install robotframework robotframework-seleniumlibrary
# Default command
CMD [ "python3" ]
- Build the image
$ podman build -t robot-framework:latest .
- Create container
$ podman run -d --name robot_framework localhost/robot-framework:latest
- Go inside the container
$ podman exec -it robot_framework bash
- Create a test.robot file with given content
$ vim test.robot
*** Settings ***
Library SeleniumLibrary
*** Test Cases ***
Example Test
Open Browser chrome
sleep 10s
----------------------------------------------------------------------------------------
- Run the test.robot file and got the error
$ robot test.robot
STEP-RUN-ROBOT-TESTS
==============================================================================
Source
==============================================================================
Source.Test
==============================================================================
Test the code share | FAIL |
WebDriverException: Message: Service /root/.cache/selenium/chromedriver/linux64/133.0.6943.98/chromedriver unexpectedly exited. Status code was: 127
------------------------------------------------------------------------------
Source.Test | FAIL |
1 test, 0 passed, 1 failed
==============================================================================
Source | FAIL |
1 test, 0 passed, 1 failed
==============================================================================
Output: /workspace/source/reports/output.xml
Log: /workspace/source/reports/log.html
Report: /workspace/source/reports/report.html