Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to combine Python+Selenium and Chrome perfectly

Shulou Source: shulou.com Published: 2022-06-03 06:56:21 09月23日 Update

Preface: recently, some students have problems using firefox when learning Selenium, so they want to try chrome, but they encounter a variety of problems when using crome. The following articles are specially arranged for those who encounter this problem for reference.

The whole article: how to solve it? Please refer to the following.

Introduction to the basic environment:

Python3.5 + selenium2.48 (or above) + chrome (version 65.0.3325.181 64 bit), in which chrome has been updated to the latest version as of April 2018.

Download chromedriver.exe

The chromedriver.exe file is the driver file that calls chrome, so the version of the file must be compatible with the version of chrome

The chromedriver.exe download address is as follows: http://chromedriver.storage.googleapis.com/index.html

There are many versions of chromedriver.exe, and the version for chrome (version 65.0.3325.181) is the version shown below (2.37).

Click version 2.37 in the figure above.

3. Put the downloaded chromedriver.exe (2.37) into (copy or move) to the installation directory of chrome (the general installation path for chrome is as follows, C:\ Program Files (x86)\ Google\ Chrome\ Application)

4. Set the system environment variable to add the path of chrome to Path (the steps are as follows).

5. Open IDE (such as pycharm) to write code and test it as follows:

6. Running the code in step 5 is very likely to report an error, giving an error message similar to chromedriver.exe. Path. How to solve the problem?

Close all open chrome browsers and run them again.

If you close the chrome browser, it will not work, and you will report an error, then restart the computer and it should be fine.

7. After solving the problem in step 6, you can call chrome through selenium.

Conclusion: that's it. It's done. I hope it's helpful to you.

Tags: Version code file problem browser environment path report reference browse run no done so far above below information again variables you can use the Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia MariaDB OPPO Reno Shulou Technology MySQL