DEV Community

George Karanikolas
George Karanikolas

Posted on

3

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

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs