DEV Community

George Karanikolas
George Karanikolas

Posted on

Tutorial Selenium

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

Top comments (0)