forked from DudyShavit/docker-js-demo-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpage_object.py
56 lines (42 loc) · 1.86 KB
/
page_object.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
51
52
53
54
55
56
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
class PageObject:
def __init__(self):
self.driver = self.init_driver()
self.driver.maximize_window()
self.driver.implicitly_wait(10)
self.driver.get("http://localhost:3000/")
def init_driver(self):
driver = webdriver.Chrome()
return driver
def edit_button(self):
self.driver.find_element_by_xpath('//*[@id="container"]/button').click()
def edit_name(self):
name_button = self.driver.find_element_by_id("input-name")
name_button.clear()
name_button.send_keys("Itzhak Stern")
return name_button
def edit_email(self):
email_button = self.driver.find_element_by_id("input-email")
email_button.clear()
email_button.send_keys("sss@example.com")
return email_button
def edit_interests(self):
interests_button = self.driver.find_element_by_id("input-interests")
interests_button.clear()
interests_button.send_keys("AI")
return interests_button
def update_button(self):
self.driver.find_element_by_xpath('//*[@id="container-edit"]/button').click()
def open_mongo_express(self):
self.driver.get('http://localhost:8080/')
self.driver.find_element_by_xpath("/html/body/div/div[2]/div/div[1]/div[2]/table/tbody/tr[4]/td[2]/h3/a").click()
self.driver.find_element_by_xpath("/html/body/div/div[2]/div/div[1]/div[2]/table/tbody/tr/td[5]/h3/a").click()
def mongo_express_data(self):
return self.driver.find_elements_by_class_name("tableContent")
def mongo_express_name(self):
return self.mongo_express_data()[4].text
def mongo_express_email(self):
return self.mongo_express_data()[2].text
def mongo_express_interests(self):
return self.mongo_express_data()[3].text