ChromeDriver + Selenium installation

Introduction

  • Selenium is an automated testing tool that we can use it drive the browser perform specific actions, such as clicking, drop-down and other operations
  • ChromeDriver Chrome is a browser driver for driving the Google Chrome complete the appropriate action

Selenium installation

Related Links

Installation Procedure (Windows / Linux Universal)

  1. The installation command:pip install selenium
  2. Verify that the installation was successful
    1. Python interactive mode to enter the command line:python
    2. Selenium import library:import selenium
    3. If no error is proved that the installation was successful, otherwise fail

ChromeDriver installation

Related Links

installation steps

  1. Download Chrome browser version and operating system corresponding to the type of ChromeDriver archive (or may not work)
  2. Extracting archive ChromeDriver
  3. The ChromeDriver executable file to configure the environment variables
    • Windows
      • Recommendations directly to the chromedriver.exe file onto a Python Script directory
      • May individually be path configuration environment variable, right "this computer" -> "Properties" -> "Advanced System Settings" -> "Advanced" -> "Environment variables", the "environment variable" a "Path" in Tap New to enter chromedriver.exe path to the file, and click OK
    • Linux
      • The executable file can move to the / usr / bin directory:sudo mv <chromedriver> /usr/bin
      • May be separately configured to route the PATH $ (e.g. in the / usr / local under chromedriver / chromedriver directory)
        1. Excuting an order:export PATH="$PATH:/usr/local/chromedriver"
        2. Excuting an order:source ~/.profile
  4. Verify that the installation was successful (Windows / Linux Universal)
    • Execute commands directly at the command line:chromedriver
    • If no error is proved installed and configured properly, otherwise fail

If successful test configuration (Windows / Linux Universal)

  1. Python interactive mode to enter the command line:python
  2. Execute the code:
from selenium import webdriver
browser = webdriver.Chrome()
  • If you bring up a blank Chrome browser, the configuration was successful
  • If you flash back pop-up browser, then ChromeDriver version and the version is not compatible with Chrome

Guess you like

Origin www.cnblogs.com/madmanlyy/p/12071057.html