forked from Mohabeldiin/test-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTask1.py
More file actions
29 lines (21 loc) · 829 Bytes
/
Task1.py
File metadata and controls
29 lines (21 loc) · 829 Bytes
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
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
driver = webdriver.Chrome("C:\\Program Files (x86)\\chromedriver.exe")
driver.get("https://techwithtim.net")
print(driver.title)
search = driver.find_element(By.NAME, "s")
search.send_keys("test")
search.send_keys(Keys.RETURN)
try:
main = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.ID, "main"))
)
articals = main.find_elements(By.TAG_NAME, "article")
for articale in articals:
header = articale.find_element(By.CLASS_NAME, "entery-summary")
print(header.text)
finally:
driver.quit()