-
Notifications
You must be signed in to change notification settings - Fork 0
/
ciperpus_element.py
67 lines (48 loc) · 1.39 KB
/
ciperpus_element.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
57
58
59
60
61
62
63
64
65
66
67
from selenium import webdriver
class ciperpus_element:
def __init__(self, element, driver):
self.element = element
self.driver = driver
@property
def client(self):
return self.driver.client
def click(self):
return self.element.click()
def clear(self):
return self.element.clear()
def find_element(self, selector):
return ciperpus_element(self.page.find_element_by_css_selector(selector), self.driver)
def find_elements(self, selector):
return [ciperpus_element(el, self.driver) for el in self.page.find_element_by_css_selector(selector)]
def attr(self, attr):
return self.element.get_attribute(attr)
def prop(self, prop):
return self.element.get_property(prop)
def css(self, attr):
return self.element.value_of_css_property(attr)
@property
def is_displayed(self):
return self.element.is_displayed()
@property
def is_enabled(self):
return self.element.is_enabled()
@property
def is_selected(self):
return self.element.is_selected()
@property
def text(self):
return self.element.text
@property
def size(self):
return self.element.size
@property
def tag_name(self):
return self.element.tag_name
def screenshot(self, filename):
return self.element.screenshot(filename)
def send_keys(self, value):
return self.element.send_keys(value)
def select_file(self, path):
return self.send_keys(path)
def submit(self):
return self.element.submit()