Closed sayom88 closed 4 years ago
hi @sayom88,
You are getting into this situation because you are running the python based image directly, which it will start python directly on run. To run any shell command in the image, you could start an interactive session with the bash
or sh
command (for ubuntu / alpine environment).
e.g.
$ docker run -it selenium_test_python:latest bash
Furthermore if you want to run the test script in your local machine working directory, you could specify the working directory like this:
C:\Users\ME> docker run -it -w /usr/workspace -v $(pwd):/usr/workspace selenium_test_python:latest bash
root@6badcc92f454:/usr/workspace# python test_script.py
test_case_1 (__main__.TestTemplate)
Find and click top-right button ... test_script.py:18: DeprecationWarning: use options instead of chrome_options
self.driver = webdriver.Chrome(chrome_options=chrome_options)
ok
test_case_2 (__main__.TestTemplate)
Find and click Learn more button ... test_script.py:18: DeprecationWarning: use options instead of chrome_options
self.driver = webdriver.Chrome(chrome_options=chrome_options)
ok
----------------------------------------------------------------------
Ran 2 tests in 10.037s
OK
root@6badcc92f454:/usr/workspace# exit
exit
okie thanks
Hello, I am very new to docker concept. I am using Windows 10. I have created the docker build successfully using the dockerfile that you have mentioned for Python 3.8 ( https://github.com/joyzoursky/docker-python-chromedriver/blob/master/py3/py3.8/Dockerfile) My docker image name is selenium_test_python:latest Now when I try to run the docker to run the python script test_script.py using the following command as below,then I am getting this as C:\Users\SAYOMGHOSH>docker run -it selenium_test_python:latest Python 3.8.3 (default, May 14 2020, 22:42:38) [GCC 8.3.0] on linux Type "help", "copyright", "credits" or "license" for more information.