Selenium + python Development Environment setup, seleniumpython
Introduction to web debugging tools and development environment setup
Python and selenium development environment:
1. Download python software: https://www.python.org/
After the download is complete, install it. After the installation is successful, open IDLE (Python 3.6.2), for example:
For example, enter print ("Hello Wrod! ") Press enter to display Hello Wrod !, It indicates that the IDLE has been installed. Open the DOS command window and enter Python and press Enter. For example:
The python version number and other information indicate that python has been installed successfully. If an error occurs, you need to configure the environment variable:
Add the python installation directory in the Environment System variable Path, for example, C: \ Python35 \ Scripts; C: \ Python35 \. This is the directory installed on the C drive.
Ii. Install pip: https://pypi.python.org/pypi/pip
After the download is complete, decompress the package. Open the doscommand window and enter the extracted folder (for example, D: \ pip-9.0.1, which is the extracted pip folder). Enter the following information:
Enter the following information and press the Enter key to install, after installation is displayed installation directory: C: \ Python35 \ Lib \ site-packages \ pip-9.0.1-py3.5.egg
Enter pip.exe in the doscommand window and press enter, for example:
Then configure the environment variable and add C: \ Python35 \ Lib \ site-packages \ pip-9.0.1-py3.5.egg in the Environment System variable Path (this is the directory installed on disk C ).
Open IDLE (Python 3.6.2) again and enter import selenium and press enter, for example:
If selenium is not found, use the pip install-U selenium command to install selenium.
Use selenium to open the firefox browser:
First, go to the same directory as python.exe)
In IDLE (Python 3.6.2), enter import selenium and press Enter. Then, re-enter from selenium import webdriver and press Enter. Finally, enterBrowser = webdriver. Firefox ()Press enter to successfully call the firefox browser.
Firefox front-end tools:
1. fireBug: a set of development plug-ins in FireFox
2. Purpose: view the elements on the page and locate them based on their attributes.
To install fireBug, open the FireFox browser and install it on a chip:
Front-end technology introduction:
1. html: the foundation of a Web page. It is a markup language that displays data;
2. JS: Front-End scripting language, interpreted language, and interactive behavior added to the page;
3. xml: Extended Markup Language for data transmission and storage
4. css: stacked style sheets for displaying file styles such as HTML and XML
Use selenium to open the chrome browser (install Chrome webdriver ):
1.install chromeviewer 2.download chromedriver.exe+3.put the downloaded chromedriver.exe file under the Chrome browser directory (for example, C: \ Users \ Administrator \ AppData \ Local \ Google \ Chrome \ Application) 4. configure the environment variables and add C: \ Users \ Administrator \ AppData \ Local \ Google \ Chrome \ Application to the Environment System variable Path.
In IDLE (Python 3.6.2), enter import selenium and press Enter. Then, re-enter from selenium import webdriver and press Enter. Finally, enterB = webdriver. Chrome ()Press enter to successfully call the chrome browser.