Description
Hello, I am new to docker and I am trying to run my selenium ui tests in windows docker container.
I have the ChromeDriver and ChromeInstaller copied and installed on my Dockerfile.
Please, please give me advise on my issue. Thank you.
But when doing docker run, I am getting this error
> Error Message: Message: unknown error: Chrome failed to start: crashed.
> (chrome not reachable)
> (The process started from chrome location C:\Program Files\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
> selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed.
> (chrome not reachable)
> (The process started from chrome location C:\Program Files\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Steps to reproduce the issue:
- Create DOCKERFILE
- build image from DOCKERFILE
- Docker run
Describe the results you received:
I keep getting error that Chrome has crashed when I do docker run and gauge command to run test
PS C:\Users\jlabiseg\Repos\flnt-automation\uiregressionframework> docker run flntautomation/automation-tests:automation-framework run --env flnt-uat-headless --tags visit_flnt
Python: 3.7.3
Error Message: Message: unknown error: Chrome failed to start: crashed.
(chrome not reachable)
(The process started from chrome location C:\Program Files\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Stacktrace:
Traceback (most recent call last):
File "C:\Python\lib\site-packages\getgauge\executor.py", line 33, in execute_method
step.impl(*params)
File "C:\tests\step_impl\common\page_factory.py", line 46, in init
chromeDriver()
File "C:\tests\step_impl\common\page_factory.py", line 141, in chromeDriver
PageFactory.driver = webdriver.Chrome(desired_capabilities=capabilities,chrome_options=PageFactory.driver_options,executable_path="C://chromedriver//chromedriver.exe")
File "C:\Python\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 81, in __init__
desired_capabilities=desired_capabilities)
File "C:\Python\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "C:\Python\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Python\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Python\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed.
(chrome not reachable)
(The process started from chrome location C:\Program Files\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Describe the results you expected:
I am expecting to have a successful run of ui tests.
I cant seem to make Chrome work even if it was installed
Output of docker version
:
Client: Docker Engine - Community
Cloud integration: 1.0.4
Version: 20.10.0
API version: 1.41
Go version: go1.13.15
Git commit: 7287ab3
Built: Tue Dec 8 18:55:31 2020
OS/Arch: windows/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.0
API version: 1.41 (minimum version 1.24)
Go version: go1.13.15
Git commit: eeddea2
Built: Tue Dec 8 19:07:44 2020
OS/Arch: windows/amd64
Experimental: true
Output of docker info
:
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Build with BuildKit (Docker Inc., v0.4.2-docker)
scan: Docker Scan (Docker Inc., v0.5.0)
Server:
Containers: 2
Running: 0
Paused: 0
Stopped: 2
Images: 36
Server Version: 20.10.0
Storage Driver: windowsfilter (windows) lcow (linux)
Windows:
LCOW:
Logging Driver: json-file
Plugins:
Volume: local
Network: ics internal l2bridge l2tunnel nat null overlay private transparent
Log: awslogs etwlogs fluentd gcplogs gelf json-file local logentries splunk syslog
Swarm: inactive
Default Isolation: hyperv
Kernel Version: 10.0 19042 (19041.1.amd64fre.vb_release.191206-1406)
Operating System: Windows 10 Pro Version 2009 (OS Build 19042.685)
OSType: windows
Architecture: x86_64
CPUs: 8
Total Memory: 15.78GiB
Name: DESKTOP-CKD24S2
ID: HBNR:X3PW:Y27W:ZTNT:Q5TO:RNIS:VFV3:IDIN:BGGN:NYGR:BWWY:KBFP
Docker Root Dir: C:\ProgramData\Docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: true
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine
Sample DOCKERFILE:
FROM python:3.7.3-windowsservercore-1809 as python
WORKDIR /chromedriver
COPY ./chromedriver.exe c:/chromedriver
ENV CHROMEDRIVER_HOME="C:\chromedriver"
#add to PATH
SHELL ["cmd", "/S", "/C"]
RUN setx /M PATH "%PATH%;%CHROMEDRIVER_HOME%"
WORKDIR /chrome
# copy and install ChromeStandaloneSetup64.exe
COPY ./ChromeStandaloneSetup64.exe ./
# install chrome
RUN .\ChromeStandaloneSetup64.exe /silent /install
# check if chrome is installed in default directory
SHELL ["cmd", "/S", "/C"]
RUN wmic datafile where name="C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"
Output of Build
> PS C:\Users\jlabiseg\Repos\flnt-automation\uiregressionframework> docker build -t flntautomation/automation-tests:automation-framework .
> Sending build context to Docker daemon 110.6MB
> Step 1/34 : FROM python:3.7.3-windowsservercore-1809 as python
> ---> 22a423a5db36
> Step 2/34 : WORKDIR /chromedriver
> ---> Running in a77e496da4f9
> Removing intermediate container a77e496da4f9
> ---> c3cfa0d0e22c
> Step 3/34 : COPY ./chromedriver.exe c:/chromedriver
> ---> ab8aa63fa1b3
> Step 4/34 : ENV CHROMEDRIVER_HOME="C:\chromedriver"
> ---> Running in 07fdf9554a69
> Removing intermediate container 07fdf9554a69
> ---> c720848dc341
> Step 5/34 : SHELL ["cmd", "/S", "/C"]
> ---> Running in d8f88fa3f835
> Removing intermediate container d8f88fa3f835
> ---> 6b6484d63054
> Step 6/34 : RUN setx /M PATH "%PATH%;%CHROMEDRIVER_HOME%"
> ---> Running in 2a3101c74092
>
> SUCCESS: Specified value was saved.
> Removing intermediate container 2a3101c74092
> ---> e4b530f63048
> Step 7/34 : WORKDIR /chrome
> ---> Running in f1b9fd1e532f
> Removing intermediate container f1b9fd1e532f
> ---> 724c3778a5fb
> Step 8/34 : COPY ./ChromeStandaloneSetup64.exe ./
> ---> 358e3302df59
> Step 9/34 : RUN .\ChromeStandaloneSetup64.exe /silent /install
> ---> Running in d30f5f042a51
> Removing intermediate container d30f5f042a51
> ---> 747e3ac72223
> Step 10/34 : SHELL ["cmd", "/S", "/C"]
> ---> Running in 44b0351abf5c
> Removing intermediate container 44b0351abf5c
> ---> 101ae29f8683
> Step 11/34 : RUN wmic datafile where name="C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"
> ---> Running in ee1df72c67a1
> AccessMask Archive Caption Compressed CompressionMethod CreationClassName CreationDate CSCreationClassName CSName Description Drive EightDotThreeFileName Encrypted EncryptionMethod Extension FileName FileSize FileType FSCreationClassName FSName Hidden InstallDate InUseCount LastAccessed LastModified Manufacturer Name Path Readable Status System Version Writeable
> 18809343 TRUE c:\program files\google\chrome\application\chrome.exe FALSE CIM_LogicalFile 20210101203125.000962+480 Win32_ComputerSystem EE1DF72C67A1 c:\program files\google\chrome\application\chrome.exe c: c:\program files\google\chrome\application\chrome.exe FALSE exe chrome 2238448 Application Win32_FileSystem NTFS FALSE 20210101203125.000962+480 20210101203133.027283+480 20201202100132.750000+480 Google LLC c:\program files\google\chrome\application\chrome.exe \program files\google\chrome\application\ TRUE OK FALSE 87.0.4280.88 TRUE
>
> Removing intermediate container ee1df72c67a1
> ---> 7a45b0c81f04