-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
36 lines (26 loc) · 1.01 KB
/
main.py
File metadata and controls
36 lines (26 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time
# https://www.youtube.com/watch?v=NB8OceGZGjA
# https://sites.google.com/chromium.org/driver/
option = webdriver.ChromeOptions()
driver = webdriver.Chrome(options = option)
driver.get('https://www.google.com/')
WebDriverWait(driver, 5).until(
EC.presence_of_element_located((By.CLASS_NAME, "gLFyf"))
)
input_element = driver.find_element(By.CLASS_NAME, "gLFyf")
input_element.clear()
input_element.send_keys("tech with tim" + Keys.ENTER)
WebDriverWait(driver, 5).until(
EC.presence_of_element_located((By.PARTIAL_LINK_TEXT, "Tech With Tim"))
)
link = driver.find_element(By.PARTIAL_LINK_TEXT, "Tech With Tim")
link.click()
time.sleep(10)
driver.quit()