
You need to add the next lines to your Dockerfile: # install google chrome Options.add_argument('-headless') # exampleĭriver = webdriver.Remote("", options=options)

If you use webdriver.ChromeOptions|FirefoxOptions|etc then DesiredCapabalities import is not necessary: from selenium import webdriver

Self.browser = webdriver.Remote(" DesiredCapabilities.FIREFOX) To do this as a django test do the following: # docker-compose.yml If you want you can also launch a Selenium Grid hub. You need to launch a standalone chrome browser docker run -d -p 4444:4444 selenium/standalone-chromeĪnd then in your python script launch browser using Remote webdriver from selenium import webdriverįrom _capabilities import DesiredCapabilitiesĭriver = webdriver.Remote("", DesiredCapabilities.CHROME) (Driver info: chromedriver=63 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8),platform=Linux 4.4.0-83-generic x86_64)Īnd if I run google-chrome directly in docker, it shows below: google-chromeįailed to move to new namespace: PID namespaces supported, Network namespace supported, but failed: errno = Operation not permitted : Message: unknown error: Chrome failed to start: crashed Raise exception_class(message, screen, stacktrace) Self.error_handler.check_response(response)įile "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 194, in check_response

Response = self.execute(Command.NEW_SESSION, parameters)įile "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 249, in execute Self.start_session(desired_capabilities, browser_profile)įile "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 185, in start_session I installed google-chrome in a Docker, but when I run my Python 2 script of Selenium, it failed like this: python test.pyįile "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/chrome/webdriver.py", line 69, in _init_ĭesired_capabilities=desired_capabilities)įile "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 98, in _init_
