-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbconditionalcommands.py
More file actions
25 lines (22 loc) · 1009 Bytes
/
bconditionalcommands.py
File metadata and controls
25 lines (22 loc) · 1009 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
#use of is_selected(),is_Displayed and is_enabled()
assert "Welcome: Mercury Tours" in driver.title
user_ele= driver.find_element_by_name("userName")
print(user_ele.is_displayed()) #returns true/false based of element status
print(user_ele.is_enabled())
pwd_ele=driver.find_element_by_name("password")
print(pwd_ele.is_displayed())
print(pwd_ele.is_enabled())
driver.implicitly_wait(1)
user_ele.send_keys("mercury")
pwd_ele.send_keys("mercury")
driver.find_element_by_name("submit").click()
driver.find_element_by_link_text("Flights").click()
time.sleep(2)
roundtrip_radio= driver.find_element_by_xpath("//input")
# roundtrip_radio= driver.find_element_by_css_selector("//input[value='roundtrip']")
print("status of roundtrip radio button: ",roundtrip_radio.is_selected())
time.sleep(2)
onetrip_radio=driver.find_element_by_xpath("//input[2]")
# onetrip_radio=driver.find_element_by_css_selector("//input[value='oneway']")
print("Status of onewar radio button: ",onetrip_radio.is_selected())
driver.close()