Repository navigation
Expand file tree
/
Copy pathis_element_present.py
More file actions
180 lines (138 loc) · 10.4 KB
/
Copy pathis_element_present.py
File metadata and controls
180 lines (138 loc) · 10.4 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# -*- coding: utf-8 -*-
# Copyright 2015 splinter authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
class IsElementPresentTest(object):
def test_is_element_present_by_css(self):
"should is element present by css verify if element is present"
self.browser.find_by_css('.add-async-element').click()
self.assertTrue(self.browser.is_element_present_by_css('.async-element'))
def test_is_element_present_by_css_using_a_custom_wait_time(self):
"should is element present by css verify if element is present using a custom wait time"
self.browser.find_by_css('.add-async-element').click()
self.assertTrue(self.browser.is_element_present_by_css('.async-element2', wait_time=3))
def test_is_element_present_by_css_returns_false_if_element_is_not_present(self):
"should is element present by css returns False if element is not present"
self.assertFalse(self.browser.is_element_present_by_css('.async-elementzz'))
def test_is_element_not_present_by_css(self):
"should is element not present by css verify if element is not present"
self.assertTrue(self.browser.is_element_not_present_by_css('.async-element'))
def test_is_element_not_present_by_css_returns_false_if_element_is_present(self):
"should is element not present by css returns False if element is present"
self.assertFalse(self.browser.is_element_not_present_by_css('h1'))
def test_is_element_not_present_by_css_using_a_custom_wait_time(self):
"should is element not present by css verify if element is not present using a custom wait time"
self.assertTrue(self.browser.is_element_not_present_by_css('.async-element', wait_time=3))
def test_is_element_present_by_xpath(self):
"should is element present by xpath verify if element is present"
self.browser.find_by_css('.add-async-element').click()
self.assertTrue(self.browser.is_element_present_by_xpath('//h4'))
def test_is_element_present_by_xpath_using_a_custom_wait_time(self):
"should is element present by xpath verify if element is present using a custom wait time"
self.browser.find_by_css('.add-async-element').click()
self.assertTrue(self.browser.is_element_present_by_xpath('//h5', wait_time=3))
def test_is_element_present_by_xpath_returns_false_if_element_is_not_present(self):
"should is element present by xpath returns false if element is not present"
self.assertTrue(self.browser.is_element_not_present_by_xpath('//h4'))
def test_is_element_not_present_by_xpath_returns_false_if_element_is_present(self):
"should is element not present by xpath returns false if element is present"
self.browser.find_by_css('.add-async-element').click()
self.assertFalse(self.browser.is_element_not_present_by_xpath('//h4'))
def test_is_element_not_present_by_xpath_using_a_custom_wait_time(self):
"should is element not present by xpath verify if element is not present using a custom wait time"
self.assertTrue(self.browser.is_element_not_present_by_xpath('//h4', wait_time=3))
def test_is_element_present_by_tag(self):
"should is element present by tag verify if element is present"
self.browser.find_by_css('.add-async-element').click()
self.assertTrue(self.browser.is_element_present_by_tag('h4'))
def test_is_element_present_by_tag_using_a_custom_wait_time(self):
"should is element present by tag verify if element is present using a custom wait time"
self.browser.find_by_css('.add-async-element').click()
self.assertTrue(self.browser.is_element_present_by_tag('h4', wait_time=3))
def test_is_element_present_by_tag_returns_false_if_element_is_not_present(self):
"should is element present by tag returns false if element is not present"
self.assertFalse(self.browser.is_element_present_by_tag('h4'))
def test_is_element_not_present_by_tag(self):
"should is element not present by tag verify if element is not present"
self.assertTrue(self.browser.is_element_not_present_by_tag('h4'))
def test_is_element_not_present_by_tag_using_a_custom_wait_time(self):
"should is element not present by tag verify if element is not present using a custom wait time"
self.assertTrue(self.browser.is_element_not_present_by_tag('h4', wait_time=3))
def test_is_element_not_present_by_tag_returns_false_if_element_is_present(self):
"should is element not present by tag returns false if element is present"
self.browser.find_by_css('.add-async-element').click()
self.assertFalse(self.browser.is_element_not_present_by_tag('h4'))
def test_is_element_present_by_text(self):
"should is element present by text verify if element is present"
self.assertTrue(self.browser.is_element_present_by_text('Complex'))
def test_is_element_present_by_text_returns_false_if_element_is_not_present(self):
"should is element present by text verify if element is present"
self.assertFalse(self.browser.is_element_present_by_text('Not present'))
def test_is_element_not_present_by_text(self):
"should is element not present by text verify if element is not present"
self.assertTrue(self.browser.is_element_not_present_by_text('Not present'))
def test_is_element_not_present_by_text_returns_false_if_element_is_present(self):
"should is element not present by text returns False if element is present"
self.assertFalse(self.browser.is_element_not_present_by_text('Complex'))
def test_is_element_present_by_value(self):
"should is element present by value verify if element is present"
self.browser.find_by_css('.add-async-element').click()
self.assertTrue(self.browser.is_element_present_by_value('async-header-value'))
def test_is_element_present_by_value_using_a_custom_wait_time(self):
"should is element present by value verify if element is present using a custom wait time"
self.browser.find_by_css('.add-async-element').click()
self.assertTrue(self.browser.is_element_present_by_value('async-header-value', wait_time=3))
def test_is_element_present_by_value_returns_false_if_element_is_not_present(self):
"should is element present by value returns False if element is not present"
self.assertFalse(self.browser.is_element_present_by_value('async-header-value'))
def test_is_element_not_present_by_value(self):
"should is element not present by value verify if element is not present"
self.assertTrue(self.browser.is_element_not_present_by_value('async-header-value'))
def test_is_element_not_present_by_value_using_a_custom_wait_time(self):
"should is element not present by value verify if element is not present using a custom wait time"
self.assertTrue(self.browser.is_element_not_present_by_value('async-header-value', wait_time=3))
def test_is_element_not_present_by_value_returns_false_if_element_is_present(self):
"should is element not present by value returns False if element is present"
self.assertFalse(self.browser.is_element_not_present_by_value('default value'))
def test_is_element_present_by_id(self):
"should is element present by id verify if element is present"
self.browser.find_by_css('.add-async-element').click()
self.assertTrue(self.browser.is_element_present_by_id('async-header'))
def test_is_element_present_by_id_using_a_custom_wait_time(self):
"should is element present by id verify if element is present using a custom wait time"
self.browser.find_by_css('.add-async-element').click()
self.assertTrue(self.browser.is_element_present_by_id('async-header', wait_time=3))
def test_is_element_present_by_id_returns_false_if_element_is_not_present(self):
"should is element present by id returns False if element is not present"
self.assertFalse(self.browser.is_element_present_by_id('async-header'))
def test_is_element_not_present_by_id(self):
"should is element not present by id verify if element is not present"
self.assertTrue(self.browser.is_element_not_present_by_id('async-header'))
def test_is_element_not_present_by_id_using_a_custom_wait_time(self):
"should is element not present by id verify if element is not present using a custom wait time"
self.assertTrue(self.browser.is_element_not_present_by_id('async-header', wait_time=3))
def test_is_element_not_present_by_id_returns_false_if_element_is_present(self):
"should is element not present by id returns False if element is present"
self.browser.find_by_css('.add-async-element').click()
self.assertFalse(self.browser.is_element_not_present_by_id('async-header'))
def test_is_element_present_by_name(self):
"should is element present by name verify if element is present"
self.browser.find_by_css('.add-async-element').click()
self.assertTrue(self.browser.is_element_present_by_name('async-input'))
def test_is_element_present_by_name_using_a_custom_wait_time(self):
"should is element present by name verify if element is present using a custom wait time"
self.browser.find_by_css('.add-async-element').click()
self.assertTrue(self.browser.is_element_present_by_name('async-input', wait_time=3))
def test_is_element_present_by_name_returns_false_if_element_is_not_present(self):
"should is element present by name returns false if element is not present"
self.assertFalse(self.browser.is_element_present_by_name('async-input'))
def test_is_element_not_present_by_name(self):
"should is element not present by name verify if element is not present"
self.assertTrue(self.browser.is_element_not_present_by_name('async-input'))
def test_is_element_not_present_by_name_using_a_custom_wait_time(self):
"should is element not present by name verify if element is not present using a custom wait time"
self.assertTrue(self.browser.is_element_not_present_by_name('async-input', wait_time=3))
def test_is_element_not_present_by_name_returns_false_if_element_is_present(self):
"should is element not present by name returns false if element is present"
self.browser.find_by_css('.add-async-element').click()
self.assertFalse(self.browser.is_element_not_present_by_name('async-input'))