-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExplicitWait.py
More file actions
36 lines (30 loc) · 1.39 KB
/
Copy pathExplicitWait.py
File metadata and controls
36 lines (30 loc) · 1.39 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
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
import time
from selenium.webdriver.support import expected_conditions as EC
driver = webdriver.Firefox(executable_path="D:\driver\geckodriver.exe")
driver.implicitly_wait(5)
driver.maximize_window()
driver.get("https://www.expedia.com/")
#driver.find_element(By.ID,"tab-flight-tab-hp").click()
driver.find_element_by_id("tab-flight-tab-hp").click()
time.sleep(2)
driver.find_element_by_id("flight-origin-hp-flight").clear()
driver.find_element_by_id("flight-origin-hp-flight").send_keys("BOM")
driver.find_element_by_id("flight-destination-hp-flight").clear()
driver.find_element_by_id("flight-destination-hp-flight").send_keys("DEL")
driver.find_element_by_id("flight-departing-hp-flight").clear()
driver.find_element_by_id("flight-departing-hp-flight").send_keys("10/10/2019")
time.sleep(2)
driver.find_element_by_id("flight-returning-hp-flight").clear()
time.sleep(2)
driver.find_element_by_id("flight-returning-hp-flight").send_keys("10/11/2019")
driver.find_element_by_xpath("//*[@id='gcw-flights-form-hp-flight']/div[8]/label/button").click()
#Explicit wait
wait = WebDriverWait(driver, 20)
element = wait.until(EC.element_to_be_clickable((By.XPATH,"//*[@id='stops']/div/div[3]/div/label")))
element.click()
time.sleep(5)
driver.quit()