-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUnitTesting.py
More file actions
33 lines (24 loc) · 1.01 KB
/
UnitTesting.py
File metadata and controls
33 lines (24 loc) · 1.01 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
import unittest
from selenium import webdriver
class Hpflight(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Chrome()
self.driver.get("http://www.newtours.demoaut.com/")
def login(self):
driver=self.driver
ele=driver.find_element_by_xpath("//input[@name='userName']").text
assert ele in driver.page_source
driver.find_element_by_xpath("//input[@name='userName']").send_keys("mercury")
driver.find_element_by_xpath("//input[@name='password']").send_keys("mercury")
driver.find_element_by_xpath("//input[@name='login']").click()
ele = driver.find_element_by_xpath("//select[@name='airline']//option[1]").text
# if ele == "Blue Skies Airlines":
# assertTrue(True, "not the correct page")
# else:
# assertTrue(False, "Not authorized")
assert ele in driver.page_source
def tearDown(self):
driver=self.driver
driver.close()
if __name__ == '__main__':
unittest.main()