Selenium Python Installation Instructions

Source: Internet
Author: User
Tags selenium python

Recently bored. and re-installed a selenium.

The Times have changed. The method of installation is not the same as it used to be. It is therefore felt necessary to make a separate statement

Another remark: test the small friends. Error installing such tools. Try one of the following two scenarios:

1. Please go to StackOverflow

2.code Review

Here's a second way to fix the installation problem

If you're looking at an unofficial document, use the installation method. But some old social blogs. Then it is likely that you have won the lottery.

The correct mounting posture should look like this (take chrome + python + Selenium as an example):

1. Open https://chromedriver.storage.googleapis.com/index.html

2. Find the latest version (note: 2.30 represents a version greater than 2.9. Here 2.9 is equivalent to 2.09. I had to spit out this version number setting)

3. Download the corresponding version (note: Under Windows platform. There are no 64-bit EXE plugins. However, 32-bit can be 64-bit compatible)

4. Confirm that the version of Python that is installed is larger than the selenium callout. Generally the latest version is backwards compatible with the 3.x version. )

5. Download the Selenium package yourself or use the PIP install Selenium command to resolve the issue

So far. The installation is complete (it feels faster than it used to be)

Next is the method used:

A. Sample Code

  

B. Content description

1. The line must pass in the value of executable. Here due to the design pattern of the previous selenium. The selenium was previously identified by an environment variable setting to identify the execution path.

Now the relevant parts of the source code have been changed. Therefore, you do not need to configure environment variables to use selenium.

2. Line tenth must use the full URL link (the URL contains the prefix http://or https://). Otherwise, the domain name cannot be resolved

C. Additional Instructions for B1

Find out the problem. Read the wrong content first (do not pass the absolute path, i.e. Driver = Webdriver. Chrome ()):

    

Then look at the source code. can be found. In the construction method (Def __init__). Only executable do not have a default value. Therefore, the webdriver must be used. Chrome passes the path to initialize the variable. Otherwise the error.

The good thing about this is that. When using selenium, multiple browsers no longer have to configure environment variables separately. Put all the drivers in the project file directory. Just set the pointing position when you start

Of course. can also change the source code. Give the variable a default value. So the use of other browsers is not explained.

    

Selenium Python Installation Instructions

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.