DEV Community

loading...

Tutorial Selenium

seijind profile image George Karanikolas ・1 min read

Selenium


Selenium is library that can be useful when scraping the web. Unlike the other libraries, Selenium wasn’t originally designed for web scraping. First and foremost, Selenium is a web driver designed to render web pages like your web browser would for the purpose of automated testing of web applications.

Install Selenium

pip install selenium

Use Selenium

from selenium import webdriver

Driver setup

Chrome Link
Firefox Link
Opera Link
Edge Link

# Chrome:
chrome_driver = webdriver.Chrome(Chrome Driver Path)
# Firefox:
firefox_driver = webdriver.Firefox(Firefox Driver Path)
# Opera:
opera_driver = webdriver.Opera(Opera Driver Path)
# Edge:
edge_driver = webdriver.Edge(Edge Driver Path)
# Safari
safari_driver = webdriver.Safari() # The SafariDeriver is integrated in Safari.

Open A Website

url = "https://www.example.com"
driver.get(url)

For many resources on Selenium or anything else on Python, check out Github:
https://github.com/SeijinD/Python-World/blob/master/main/extends_libraries/selenium.md

Discussion (1)

Collapse
woodjessica profile image
Jessica Wood

Thanks for sharing this tutorial. Selenium is an open-source, test automation tool that has become an important automation tool in the software quality assurance world. This selenium testing tool consists of a different set of tools which include Selenium WebDriver, Selenium RC, Selenium IDE, and Selenium Grid, all of which have different features.

Forem Open with the Forem app