-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path08_selenium_wait.py
35 lines (26 loc) · 1.01 KB
/
08_selenium_wait.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
import time
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
url = "https://the-internet.herokuapp.com/dynamic_controls"
driver = webdriver.Chrome()
driver.maximize_window()
driver.get(url)
# set the wait time to 10 seconds
wait = WebDriverWait(driver, 10)
enable_btn = driver.find_element(By.XPATH, "//*[@id='input-example']/button")
enable_btn.click()
time.sleep(3)
disable_btn = wait.until(EC.element_to_be_clickable((By.XPATH, "//*[@id='input-example']/button")))
disable_btn.click()
remove_btn = driver.find_element(By.XPATH, "//*[@id='checkbox-example']/button")
remove_btn.click()
time.sleep(3)
add_btn = wait.until(EC.element_to_be_clickable((By.XPATH, "//*[@id='checkbox-example']/button")))
add_btn.click()
time.sleep(3)
check_box = driver.find_element(By.XPATH, "//*[@id='checkbox']")
check_box.click()
time.sleep(3)
driver.quit()