Selenium With Python
Selenium automates browsers. That's it! What you do with that power is entirely up to you.
See the official Selenium site for details and documentation.
How to install Selenium¶
pip install selenium
You will also need to install a web-driver to use Selenium. A common choice is ChromeDriver - the one we use. See the official Selenium Python documentation for details and alternatives.
How to import Selenium¶
Generally, we don't import Selenium as a whole, but rather the modules we need. Often, this will simply be the webdriver
but sometimes, we need to import other modules as well, for example
from selenium import webdriver
to simulate key-presses with
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
to select elements By their HTML properties.
Check out seleniumplayground.practiceprobs.com - our sample site where you can scrape data, click buttons, and submit forms without fear of violating our terms of service.