-
Notifications
You must be signed in to change notification settings - Fork 0
/
sel2.py
53 lines (36 loc) · 1.2 KB
/
sel2.py
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
driver = webdriver.Chrome()
driver.get("https://www.google.co.in/")
elem = driver.find_element_by_name("q")
elem.send_keys("go go anime")
elem.send_keys(Keys.RETURN)
element = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.PARTIAL_LINK_TEXT, "anime"))
)
element.click()
elem = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.NAME, "keyword_search"))
)
elem.click()
elem.send_keys("steins gate")
elem.send_keys(Keys.RETURN)
elem = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.LINK_TEXT, "Steins;Gate"))
)
elem.click()
elem = WebDriverWait(driver, 20).until(
EC.presence_of_element_located((By.PARTIAL_LINK_TEXT, "EP 25"))
)
elem.click()
elem = WebDriverWait(driver, 20).until(
EC.presence_of_element_located((By.CLASS_NAME, "btndownload"))
)
elem.click()
elem = WebDriverWait(driver, 20).until(
EC.presence_of_element_located((By.CLASS_NAME, "Download openload"))
)
elem.click()