Python+Selenium (1) environment construction

      Python+Selenium ( 1 ) environment construction

1.  Python download and install

   Enter the Python official website to download, the version I use is Python3.4.6 , and install it according to the instructions of the installation wizard.

             

Enter cmd to verify:

            

2.  Install Selenium

Find the location where Python is installed, open CMD , and cd to Python 's Scripts folder; install Selenium through the pip command .

Command: pip install selenium

 

3.  Install FrieFox browser

   It is recommended to download the version above 55. The lower version will have compatibility problems with Python3+Selenium , which will not work properly.

   Download the FireFox browser driver: geckodriver.exe and store it in the Python root directory ( same directory as python.exe ).

Download address: https://github.com/mozilla/geckodriver/releases

4.  Verify the built environment

1. Start cmd , enter the command window, and enter Python ;

2.>>from selenium import webdriver;

3.>>driver = webdriver.Firefox();

4.>>driver.get(‘https://www.baidu.com’)

   

5.  Install the Python IDE tool PyCharm

 

6.  Pit encountered when building the environment

   6.1 does not have Firefox geckodriver installed .

      solve:

        Download the FireFox browser driver: geckodriver.exe and store it in the Python root directory ( same directory as python.exe ).

Download address: https://github.com/mozilla/geckodriver/releases

 

   6.2Firefox browser is not compatible with Selenium 3.X version.

       solve:

          Update your browser to the latest version

 

 

 

 

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325798317&siteId=291194637