Stand on the shoulders of friends to learn!!!
Prerequisite: The python environment has been built
1. Installing Selenium
Command line Input "pip install Selenium" one-click Installation
2. Check if the selenium is installed successfully
Use the command "Pip show Selenium" to see the version information that is installed on the current system
3. Successful installation, can run Python script
Expected to reach: Open the Firefox browser, enter the Baidu URL, open the Baidu interface, in the Baidu search box, enter the "Selenium2" keyword, then click "Baidu" button search results, and then automatically close the browser
Post code:
Note: If the run fails, the browser cannot be opened and an error message is returned
This is because the Firefox browser has updated the new engine in the new version. Previous versions of Firefox were using Google's native drivers,
At that time, Google's native driver supported the Firefox engine, but now Firefox updated the engine, and Google's native driver did not do the corresponding update, so the above problems arise,
WORKAROUND: You will need to re-download a driver file named "Geckodriver.exe", and after downloading its path is configured in the PATH variable. or copy the file directly to the Python installation directory
Download path for Geckodriver.exe: https://github.com/mozilla/geckodriver/releases
Re-run, you can implement the code!!!!
Into the pit one: Forget the python installation path
Workaround: Open Our cmd command to enter Python, enter the import sys, and enter the fourth in the print (Sys.path) list will be your installation path
Into the pit two: the computer can not find the path found,
Maybe the file is hidden.
FIX: Hidden folders are displayed under Win7:
Selenium environment Build-python automated script test