Я развернул изображение jlesage/firefox следующим образом:
Код: Выделить всё
docker run -d \
--name firefox \
-p 5800:5800 \
-p 5900:5900 \
-e DISPLAY_WIDTH=1024 \
-e DISPLAY_HEIGHT=768 \
-e DISPLAY=:0 \
-v /Users/vw/DEV/docker/scripts:/scripts \
-e VNC_PASSWORD=password \
jlesage/firefox
Затем я создал скрипт Python с pyautogui, чтобы найти и щелкнуть Facebook. кнопка:
Код: Выделить всё
import os
import pyautogui
import time
# Ensure the script uses the Docker container's display
os.environ["DISPLAY"] = ":0"
# Delay to allow setup
time.sleep(3)
try:
# Locate the image within the Docker display
location = pyautogui.locateCenterOnScreen('Facebook.png', confidence=0.8)
if location:
x, y = location
# Constrain search to 1024x768
if 0
Подробнее здесь: [url]https://stackoverflow.com/questions/79215877/trying-to-automate-using-pyautogui-and-docker-firefox-but-cant-stick-to-the-co[/url]