-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathttest.py
50 lines (38 loc) · 1.85 KB
/
ttest.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import unittest
from selenium import webdriver
import time
class TestAbs(unittest.TestCase):
def test_abs1(self):
link = "http://suninjuly.github.io/registration1.html"
browser = webdriver.Chrome()
browser.get(link)
input1 = browser.find_element_by_css_selector(".first_block .form-control.first")
input1.send_keys("Ivan")
input2 = browser.find_element_by_css_selector(".first_block .form-control.second")
input2.send_keys("Petrov")
input3 = browser.find_element_by_css_selector(".first_block .form-control.third")
input3.send_keys("Smolensk")
button = browser.find_element_by_css_selector("button.btn")
button.click()
time.sleep(1)
welcome_text_elt = browser.find_element_by_tag_name("h1")
welcome_text = welcome_text_elt.text
self.assertEqual("Congratulations! You have successfully registered!",welcome_text)
def test_abs2(self):
link = "http://suninjuly.github.io/registration2.html"
browser = webdriver.Chrome()
browser.get(link)
input1 = browser.find_element_by_css_selector(".first_block .form-control.first")
input1.send_keys("Ivan")
input2 = browser.find_element_by_css_selector(".first_block .form-control.second")
input2.send_keys("Petrov")
input3 = browser.find_element_by_css_selector(".first_block .form-control.third")
input3.send_keys("Smolensk")
button = browser.find_element_by_css_selector("button.btn")
button.click()
time.sleep(1)
welcome_text_elt = browser.find_element_by_tag_name("h1")
welcome_text = welcome_text_elt.text
self.assertEqual("Congratulations! You have successfully registered!",welcome_text)
if __name__ == "__main__":
unittest.main(argv=['first-arg-is-ignored'], exit=False)