Selenium: Chrome in Docker Container: Take screenshot?

Viewed 4121

I am using the official selenium chrome driver Image: https://hub.docker.com/r/selenium/standalone-chrome/

Unfortunately, I am unable to take screenshots in the container.

This code works perfectly ok outside of the container:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

driver = webdriver.Chrome()
driver.get("http://www.python.org")
driver.save_screenshot("some_file.png")
driver.close()

but in the container, save_screenshot returns false. I found a small hint in the github of chrome, that screensize and depth must be set, but setting them to 1920 * 1080 * 24 did not change anythign

0 Answers
Related