Before reading, first you need to install Python can go directly to Python's official website to download. Recommended UsePython3, after all, the authorities soon ceased toPython2The support of
In addition, the main purpose of this article is to be used in the company's sharing session, there may be some steps will not be told so detailed
You can visit http://www.python.org Direct downloads, this is the official website of Python
Download the Python installation package, which is an. exe file, and double-click Run. Will not install students can casually Baidu Python installation tutorial
In addition, Python3 installation package comes with the function of configuration environment variable, when installing, remember to check it.
After the Python installation is complete, enter Python at the command line to see the version of Python you have installed
If prompted
is not an internal or external command, nor is it a running program
or batch File
Maybe your Python is not installed, so install Python first.
Take a look at whether the environment variable is not configured successfully
Installing Selenium
Link:http://pan.baidu.com/s/1jHGzXd0 Password: jdos
There are two compressed packages and two. exe files that can be downloaded first
Compress package Remember unzip
1. Open the command line
Shortcut keys windows + R input cmd, enter
The Windows key is the button that opens the Start menu in the lower-left corner.
2. Install PIP
Switch to the directory where the PIP files are located, remember to extract the first
For example, I unzipped the previously downloaded file and placed it on the C-drive C:\selenium\pip-9.0.1
Enter CD C:\selenium\pip-9.0.1 on the command line
Enter, so that we can successfully switch our working directory to where needed, notice that there is a space behind the CD
If you put it on the D-plate, like D: \selenium\pip-9.0.1
First Enter D:
return, enter CD D: \selenium\pip-9.0.1 Enter, There is also a space
If you have successfully switched your working directory, then enter the Python setup.py install return on the command line (don't forget the space)
You can see that the PIP has started to install
3. Installing Setuptools
Same way, divert, switch to setuptools-36.0.1 directory
Enter python setup.py install to start the installation
4. Check
Also on the command line, enter PIP show selenium to view the version of our selenium
or open the Python shell and enter the from selenium import Webdriver
If there's no error, you're done.
What if it fails? Don't worry, also command line, manually enter PIP install-u Selenium installation Selenium
5. Install the driver
Do you still have the four files that were downloaded before? Of these two compressed packages we have already used, and two are what?
Help us Open the browser's
You can try typing in the Python shell first.
1 from Import Webdriver 2 a = Webdriver. Chrome ()
This will help us to open Google Chrome (oh, forget to say, maybe you have to install Firefox or Chrome browser beforehand, this should not be difficult)
The error? Because there is no driver installed
OK, now, first copy the Geckodriver.exe to the Python installation directory, Firefox driver installation is complete
As for Google's drive, it may be a bit complicated
First, copy the Chromedriver.exe to Google's installation directory, such as C:\Program Files (x86) \google\chrome\application
The purple section differs depending on the path of each person's installation of Google Chrome.
Then copy the above path and configure to the environment variable
Yes, it's that simple.
Selenium Installation Tutorials (Python-based)