

The commonality between these two (and all other player names) is, so that is what we will be using to create a list of all player names. Using the same process, I located the next element in the list, Russell Westbrook. This element can easily be translated to its XPath, but first, we need to remember that we aren’t just trying to locate this element, but all player names. In the developer tools, we now see the element “Stephen Curry” appears as such. For my example, I first want to locate the NBA player names, so I first select Stephen Curry. To locate the element’s XPath, highlight the first in the list of what you’re looking for, right click, and select inspect this opens up the developer tools. An XPath is a syntax used for finding any element on a webpage. In order to extract the information that you’re looking to scrape, you need to locate the element’s XPath. Step 4- Locate Specific Information You’re Scraping When run, this code snippet will open the browser to your desired website. You need your code to actually open the website you’re attempting to scrape. driver = webdriver.Chrome('/Users/MyUsername/Downloads/chromedriver') Step 3 - Access Website Via Python You now can create a driver variable using the direct path of the location of your downloaded webdriver. Mine is just saved in my default downloads folder.

Now you need to know where you saved your webdriver download on your local computer. To locate what version of Chrome you have, click on the 3 vertical dots at the top right corner of your browser window, scroll down to help, and select “About Google Chrome”.

There are several different download options based on your version of Chrome. For chrome you first need to download the webdriver at.

Some say Chrome works best with Selenium, although it does also support Internet Explorer, Firefox, Safari, and Opera. This step is different based on which browser you use to explore the internet. It is what will actually be automatically opening up your browser to access your website of choice. from selenium import webdriver from import Keys import pandas as pd Step 2 - Install and Access WebDriverĪ webdriver is a vital ingredient to this process. Once installed, you’re ready for the imports. Step 1 - Install and Imports pip install selenium
