1 install chrome
docker run -d -p 4444:4444 selenium/standalone-chrome
2 Run code
# coding=utf-8 from selenium import webdriver from selenium.webdriver.common.desired_capabilities import DesiredCapabilities if __name__ == '__main__': try: driver = webdriver.Remote("http://127.0.0.1:4444/wd/hub", DesiredCapabilities.CHROME) url = "https://baidu.com/" driver.get(url) except IOError: print("Error: File not found or failed to read ") else: print("666")