-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path39_shifting_content.py
50 lines (38 loc) · 1.24 KB
/
39_shifting_content.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.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
driver = webdriver.Firefox()
try:
wait = WebDriverWait(driver, 10)
driver.get('https://the-internet.herokuapp.com/')
link = wait.until(EC.presence_of_element_located(
(By.LINK_TEXT, "Shifting Content")
))
link.click()
link1 = wait.until(EC.presence_of_element_located(
(By.LINK_TEXT, "Example 1: Menu Element")
))
link1.click()
sublink1 = wait.until(EC.presence_of_element_located(
(By.CSS_SELECTOR, "#content > div > p:nth-child(3) > a")
))
sublink1.click()
driver.back()
sublink2 = wait.until(EC.presence_of_element_located(
(By.CSS_SELECTOR, "#content > div > p:nth-child(4) > a")
))
sublink2.click()
driver.back()
sublink3 = wait.until(EC.presence_of_element_located(
(By.CSS_SELECTOR, "#content > div > p:nth-child(5) > a")
))
sublink3.click()
driver.back()
driver.back()
link2 = wait.until(EC.presence_of_element_located(
(By.LINK_TEXT, "Example 2: An image")
))
link2.click()
finally:
driver.quit()