Pre-condition: Python pip is already installed in the system.
Step One: Enter the PIP installation directory in cmd, such as: D:\python34\scripts
Step Two: Execute the installation command: Pip install selenium after the installation of the browser-driven configuration
Step three: Download browser drivers on the Internet (Google, IE, Firefox, etc.)
Fourth step: Place the downloaded browser driver in the root directory of the Python-installed directory
Fifth Step: Configure the browser-driven path to the environment variables, such as: D:\python34\Chome.exe
Complete the above steps to test by entering the following code:
From selenium import Webdriver
From time import sleep
# Open Google Browser premise has been deployed good browser-driven environment
Driver = Webdriver. Chrome ()
# Specify the URL of the access in the Open browser
Driver.get ("http://baidu.com")
If can successfully open Google Browser and visit Baidu success, prove selenium environment build success
If the browser does not start successfully at run time, the following two reasons may exist:
1, browser-driven configuration to the environment variable is not configured successfully, restart the computer to try
2, browser driver download the wrong version, re-download a
Install selenium steps (use selenium in Python)