Sitemap
featurepreneur

Microprediction/Analytics for Everyone! We help volunteers to do analytics/prediction on any data!

Selenium Python Basics

--

Selenium is an open source tool used for scraping websites, controlling web browsers and automation of web browsers. It is also written in other languages like C#, Java etc besides python.

Installation:

pip install selenium

Selenium needs a webdriver to interface with a browser. To download the chromedriver:

https://chromedriver.chromium.org/

download the chromedriver according to your chrome version.

Get Chaayagirimon’s stories in your inbox

Join Medium for free to get updates from this writer.

You can easily access the HTML of the website by inspecting the page.

Press enter or click to view image in full size

You can get specific elements by the class name, tag, name, xpath, css etc.

example commands:

find_element_by_class_name("class")find_element_by_tag_name("tag")

To find the xpath right click on the element and click on copy xpath. You can find css selector the same way.

find_element_by_xpath("xpath")find_element_by_css_selector("css")

Thank you for reading.

--

--

featurepreneur
featurepreneur

Published in featurepreneur

Microprediction/Analytics for Everyone! We help volunteers to do analytics/prediction on any data!