Configure docker to realize python+selenium Automation
Installation environment: win10
1) pre-installation check (using securable.exe or LeoMoon CPU-V.exe):
Does the system hardware support virtualization technology?
Is it enabled in BIOS?
2) install the virtual machine CentOS7:
Download vmware workstation pro: https://www.vmware.com/cn/products/workstation-pro/workstation-pro-evaluation.html
Install vmware workstation pro
Using vmware workstation pro to install virtual machine CentOS7
Mount the host shared directory: https://blog.csdn.net/jasonhector/article/details/78679135
3) install docker:
Install in the virtual machine: https://blog.51cto.com/taoismli/2171045
Configure the image repository in the virtual machine: https://blog.51cto.com/taoismli/2171108
Download the docker centos image in the virtual machine: docker pull centos
List the host local images: # docker image ls
Run the mirror instantiation container and mount the host directory as a data volume: docker run-it-- mount type=bind,source=/opt/sharefolder,target=/opt/sharefolder imageID bash / / the container will share the host's / opt/sharefolder directory to facilitate data sharing
IV) docker configuration (operate in docker container)
Install python: https://blog.csdn.net/elija940818/article/details/79238813
Install selenium:pip3 install selenium
Install firefox: download the firefox linux installation package to a shared directory, then copy it to the docker root directory and extract it
Firefox webdriver download: https://github.com/mozilla/geckodriver/releases, and put the downloaded driver into python's interactive startup directory / usr/bin/
To install HTMLTestRunner.html, please download the version that supports python 3.x
Download address: https://download.csdn.net/download/a136332462/9873996
Place the downloaded html in the $Python\ site-packages/ directory
Python3
Import sys
Sys.path
Quit ()
Cp HTMLTestRunner.py
Virtual Desktop installation: https://blog.51cto.com/taoismli/2173856
Install third-party libraries:
Bs4
Schedule
Xlrd
Xlwt
Xlutils
Chardet
Pymssql (
Https://docs.microsoft.com/en-us/sql/connect/python/pymssql/step-1-configure-development-environment-for-pymssql-python-development?view=sql-server-2017)
PyMySQL
5) Container and image operation:
Https://blog.51cto.com/taoismli/2171108
Docker container commit