最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

selenium webdriver - Robot Framework Fails to Open Browser on Host Machine When Running from Podman Container - Stack Overflow

programmeradmin3浏览0评论

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:-

  1. 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" ]
  1. Build the image
$ podman build -t robot-framework:latest .
  1. Create container
$ podman run -d  --name robot_framework localhost/robot-framework:latest
  1. Go inside the container
$ podman exec -it robot_framework bash
  1. Create a test.robot file with given content
$ vim test.robot
*** Settings ***
Library    SeleniumLibrary

*** Test Cases ***
Example Test
    Open Browser             chrome
    sleep 10s
----------------------------------------------------------------------------------------
  1. 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

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论