banner



How To Install Chromedriver In Selenium Webdriver

Installing Selenium and Chromedriver on Windows

If you want to use Selenium to scrape web sites with Chrome, just follow these steps!

This article assumes the reader knows the following:

  1. How to open a Python interpreter in a command prompt or how to run a Python script

Pace 1: Download and install Google Chrome

You lot probably already have Chrome installed, simply if you don't, yous can get it here.

Stride two: Download Chromedriver and shop information technology somewhere

Chromedriver is produced by the team behind Chrome and allows Chrome to be automatically controlled past Selenium. This is the trickiest step.

  1. Get to the latest release of chromedriver by going to the official download page.

iii. Unzip the downloaded file

four. Movement the chromedriver.exe file to a permanent home. Information technology's easiest to place it in c:\windows because that directory is already a part of the system path. If you lot choose to store it somewhere else (e.yard. c:\selenium like I do), you'll need to add that directory to your path. Here'due south some instructions on how to do that.

Pace iii: Install selenium using pip

  1. Open your Windows Command Prompt (or cmder if you lot're cool)
          pip install selenium        

Step 4: Test it out!

Here's some Python code that y'all can run to make sure that your setup is working. It should popular up a Chrome window, take you to the NASA website, and then print out the headlines from that site.

          from selenium import webdriver
driver = webdriver.Chrome()
driver.become('https://www.nasa.gov')
headlines = commuter.find_elements_by_class_name("headline")
for headline in headlines:
print(headline.text.strip())
driver.close()

Troubleshooting

If you run into any issues, it'southward likely because you didn't put the chromedriver.exe file in a folder that has been added to your system path, so try to correct that commencement before doing whatever other troubleshooting.

Source: https://medium.com/@patrick.yoho11/installing-selenium-and-chromedriver-on-windows-e02202ac2b08

Posted by: rinkphan1991.blogspot.com

0 Response to "How To Install Chromedriver In Selenium Webdriver"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel