-
Notifications
You must be signed in to change notification settings - Fork 0
/
application2.py
32 lines (26 loc) · 1.01 KB
/
application2.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
from selenium.webdriver.firefox.webdriver import WebDriver
class Application:
def __init__(self):
self.wd = WebDriver()
self.wd.implicitly_wait(60)
def open_main_page(self):
wd = self.wd
wd.get("http://localhost/addressbook/index.php")
def logout(self):
wd = self.wd
wd.find_element_by_link_text("Logout").click()
def new_contact(self, data):
wd = self.wd
wd.find_element_by_link_text("add new").click()
def login(self, username, password):
wd = self.wd
self.open_main_page()
wd.find_element_by_name("user").click()
wd.find_element_by_name("user").clear()
wd.find_element_by_name("user").send_keys("%s" % username)
wd.find_element_by_name("pass").click()
wd.find_element_by_name("pass").clear()
wd.find_element_by_name("pass").send_keys("%s" % password)
wd.find_element_by_xpath("//form[@id='LoginForm']/input[3]").click()
def destroy(self):
self.wd.quit()