-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathAssertion.py
28 lines (21 loc) · 931 Bytes
/
Assertion.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
import unittest
from selenium import webdriver
class AssertTest(unittest.TestCase):
driver = webdriver.Chrome()
driver.maximize_window()
driver.get("http://newtours.demoaut.com/")
def test1(self):
actualTitle = self.driver.title
expectedTitle = "Welcome: Mercury Tours"
self.assertEqual(actualTitle,expectedTitle)
#self.assertNotEqual(actualTitle,expectedTitle)
print("Title is:", actualTitle)
self.assertTrue(self.driver.find_element_by_name("userName").is_displayed())
print("Username field is displayed")
#self.assertFalse(self.driver.find_element_by_name("userName").is_displayed())
print("Username field is not displayed")
self.assertIn("Welcome", expectedTitle)
print("Welcome is present")
#self.assertNotIn("Python", expectedTitle)
if __name__ == "__main__":
unittest.main()