I'm facing the same problem , I want to test my application with robot Framework and Sikuli on docker . Here is my Dockerfile:
FROM python:3.8-slim-buster
# Update packages and install dependencies
RUN apt-get update && apt-get install -y \
wget \
openjdk-11-jre-headless \
&& rm -rf /var/lib/apt/lists/*
# Install Robot Framework and Sikuli library
RUN pip install robotframework
RUN pip install robotframework-SikuliLibrary
# Download and install SikuliX
RUN wget https://launchpad.net/sikuli/sikulix/2.0.4/+download/sikulixide-2.0.4.jar -O /root/sikulix.jar
# Set environment variables for SikuliX
ENV JAVA_HOME /usr/lib/jvm/java-11-openjdk-amd64/
ENV SIKULIX_HOME /root
ENV SIKULIX_JAR /root/sikulix.jar
# Copy test files into the container
COPY . /tests
# Set working directory
WORKDIR /tests
# Execute tests with Robot Framework
CMD ["robot", "--outputdir", "results", "test.robot"]
and here is my test script :
*** Settings ***
Documentation Test d'IHM par sikuli et robot framework
Library SikuliLibrary port=4119 timeout=3.0 mode=REMOTE
Library Process
Library OperatingSystem
Suite Setup Start Sikuli Process
Suite Teardown Run Keywords Close Application ${APP_PATH} AND Stop Remote Server
*** Variables ***
${IMAGES_PATH} //tests/SikuliImages
${APP_PATH} //tests/FHF_App.exe
***Test Cases***
Open IHM
Open IHM Application
Read Images
Read Images From Path
Navigate IHM Application Buttons
Navigate Buttons
*** Keywords ***
Start Sikuli Process
${port}= Set Environment Variable SIKULI_SERVER_PORT 4119 # Port souhaité, par exemple 4119
Run java -jar sikulix.jar -p ${port}
Sleep 3s # Attendre que le processus Sikuli démarre
Read Images From Path
Add Image Path ${IMAGES_PATH}
Open IHM Application
Open Application ${APP_PATH}
Navigate Buttons
Wait Until Screen Contain pauseButtonPull.png timeout=30
Click pauseButtonPull.png
Wait Until Screen Contain pausePanel.png timeout=40
Click pauseButtonDown.png
Click PexpButtonPull.png
Wait Until Screen Contain PexpPanel.png timeout=10
Click PexpButtonDown.png
When I run the test I got the following error :
Test :: Test d'IHM par sikuli et robot framework
Open IHM | FAIL |
AttributeError: 'NoneType' object has no attribute 'run_keyword'
Read Images | FAIL |
AttributeError: 'NoneType' object has no attribute 'run_keyword'
Navigate IHM Application Buttons | FAIL |
AttributeError: 'NoneType' object has no attribute 'run_keyword'
Test :: Test d'IHM par sikuli et robot framework | FAIL |
Suite teardown failed:
Several failures occurred:
AttributeError: 'NoneType' object has no attribute 'run_keyword'
AttributeError: 'NoneType' object has no attribute 'run_keyword'
3 tests, 0 passed, 3 failed
Can anyone help me with that please ?
I don't know if is it a Sikuli problem or docker. The same test pass on local (windows) but not on docker
You must install correct Sikuli in the container. You should look for sikuli-linux archive and not the sikuli IDE.
Also the way to start Sikuli is not with
Run. You should useStart Sikuli Processif library is imported withmode=NEW. Consult the documentation here.Another thing is the version of Sikuli that you should use the newest, 2.0.5.