-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShortURL.py
More file actions
18 lines (16 loc) · 748 Bytes
/
ShortURL.py
File metadata and controls
18 lines (16 loc) · 748 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from selenium import webdriver
from selenium.webdriver.common.by import By
from webdriver_manager.firefox import GeckoDriverManager
from selenium.webdriver.firefox.service import Service
from selenium.webdriver.firefox.options import Options
options = Options()
options.add_argument("--headless")
driver = webdriver.Firefox(service=Service(GeckoDriverManager().install()), options=options)
driver.get("https://www.shorturl.at/")
driver.implicitly_wait(3)
search = driver.find_element(By.CSS_SELECTOR, "input[name='u']")
search.send_keys(input("Enter URL: "))
driver.find_element(By.CSS_SELECTOR, "[type='submit']").click()
driver.implicitly_wait(5)
print(driver.find_element(By.CSS_SELECTOR, "[type='text']").get_attribute('value'))
driver.close