One article quickly teach you to build Python + selenium environment

For many white want to learn in terms of automation, build environment, it has always been a very troublesome thing, let's automation environment based on the Python language to the building, including python3, Selenium, WebDriver to build a series of content .

Environment to build the Python:

Currently testing industry application programming language, Python was undoubtedly headed. python now mainstream should be 3.7 (or 3.8, but it does not matter).

Installing Python is a very simple matter, in the official website directly select the corresponding system version download, and then double-click to install, the installation path can be customized, not necessarily need to be installed on the C drive, but the Chinese path to avoid as much as possible.

You can directly Baidu search Python's official website, and then download the official website.

Download the official website:

https://www.python.org

Many people search online information on installation time, you will see after installing python installation package, you need to configure the environment variables, in fact, during the installation of 3.7, there is an "add python to path" option can be called a tick (about this name). Will automatically add the python after checking in to the system environment variable Path. Of course, you can also choose to manually add, add the following method:

Environment Variables - modifying path variable -C: \ Python37; C: \ Python37 \ Scripts;

python path here is my installation path, you replicate on their own installation path.

After the installation, operation CMD window, type python instruction, for checking whether the installation is successful python (check result is intuitive, it does not show).

Environment to build the Selenium:

After installing Python, Selenium can be installed directly deployed.

In python, can be installed by mounting Selenium PIP, installation is as follows:

1. Start cmd window

2. Enter pip install selenium

3. Wait cmd window prompts successful, the selenium successful installation

Then you can see the download selenium mounted executed. Of course, there will be some problems and countermeasures.

1. pip instruction is not recognized, the system configuration is generally variable path when equipped with less or not, check the path variable, or go into run under cmd window python37 / Scripts path, then execute instructions pip

2. Install error, suggesting HTTPConnectPool error, saying it was Read TimeOut her. Specific content can not remember, probably like this. If the error occurs can be considered alternative source solution may be added at the end of a command instruction pip "--default-timeout = 1000", typically within the timeout success because the default time is not connected, it being given. Long delay this error occurs when modifying the default timeout.

Environment to build the WebDriver:

WebDriver choice for many beginners are more ignorant to force things, but this is actually a very short answer thing. To the Chrome browser, for example.

1. Check the version of the Chrome browser (this is the base operation, right?)

2. Go to Baidu, chromedirver keyword search, the search results will see a link called ChromeDriver Mirror, do not hesitate to point directly into it.

3. not click on a higher version, which has called Notes.txt of content, click on the go, see Support Chrome describe this line, described here is the current browser version chromedriver supported, then the contents of the file adaptation find yourself chrome version of the browser, select the download. Note that, the selected 32-bit Windows download (download because there is no 64-bit entries) alone.

If the software testing, interface testing, automated testing, interviewing the exchange of experience. We love interest may focus on a small yard with disabilities, there will be irregular distribution of free data links, as well as technical exchanges with counterparts in the public number. These data are collected from various technical site, sorted out, if you have a good learning materials can whisper send me, I will share to you after attribution.

Basically the way I described to do, install all three environments are not so what's the problem. If you need to check whether the correct environment to build themselves, you can then install a compiler, for example Pycharm. After installation, the selenium introduced into the module, the simplest operation code view can run successfully. If successful, it means that your environment installation was successful.

Sample code:

from the Selenium Import webdriver 

Driver = webdriver.Chrome () 

# links because they can not write, so fill their own url 

Driver. GET (any one of the url)

 

Guess you like

Origin www.cnblogs.com/nanaheidebk/p/12567170.html