-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_3_2_13.py
38 lines (33 loc) · 1.76 KB
/
test_3_2_13.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
from selenium import webdriver
import unittest
class TestNewTestCase(unittest.TestCase):
def test_registration(self):
self.browser = webdriver.Chrome()
self.browser.get("http://suninjuly.github.io/registration1.html")
self.name = self.browser.find_element_by_css_selector("[placeholder='Input your first name']")
self.name.send_keys("Alexei")
self.last = self.browser.find_element_by_css_selector('[placeholder="Input your last name"]')
self.last.send_keys("Romashov")
self.email = self.browser.find_element_by_css_selector('[placeholder="Input your email"]')
self.email.send_keys("asd@asdd.com")
self.submit = self.browser.find_element_by_tag_name("button")
self.submit.click()
self.h1 = self.browser.find_element_by_tag_name("h1")
self.phrase = self.h1.text
self.assertEquals(self.phrase, 'Congratulations! You have successfully registered!', 'Some error')
self.browser.quit()
def test_registration2(self):
self.browser = webdriver.Chrome()
self.browser.get("http://suninjuly.github.io/registration2.html")
self.name = self.browser.find_element_by_css_selector('[qplaceholder="Input your name"]')
self.name.send_keys("Alex")
self.email = self.browser.find_element_by_css_selector('[placeholder="Input your email"]')
self.email.send_keys("aasdf")
self.submit = self.browser.find_element_by_tag_name("button")
self.submit.click()
self.h1 = self.browser.find_element_by_tag_name("h1")
self.phrase = self.h1.text
self.assertEquals(self.phrase, 'Congratulations! You have successfully registered!', 'Some error')
self.browser.quit()
if __name__ == "__main__":
unittest.main()