It is possible yes, to start remember to download, according to the browser version, the chromedriver if you are using the browser Google Chrome
or the geckodriver if you are using the browser Firefox
, and leave the executable in the same path as your execution file.
Start your code by importing the module selenium
:
from selenium import webdriver
To define which site you will open, create a vaiável that will receive a input
:
url = str(input('Site: '))
Once done, create the variable driver
which will receive the browser:
driver = webdriver.Chrome()
Finally, add the method .get()
in the variable driver
putting the variable url
as a parameter to access the site:
driver.get(url)
The whole code goes like this:
from selenium import webdriver
url = str(input('Site: '))
driver = webdriver.Chrome()
driver.get(url)
To learn more about the module Selenium
, Click here