@@ -11,54 +11,169 @@ def __init__(self, ctx):
11
11
12
12
@keyword
13
13
def wait_for_request_url (self , url , method = 'GET' , timeout = None ):
14
- """Wait for request url"""
14
+ """
15
+ Wait until web application sent request to ``url``.
16
+
17
+ The ``url`` is request url.
18
+
19
+ The ``method`` is HTTP Request Methods:
20
+ - GET (default)
21
+ - POST
22
+ - PUT
23
+ - HEAD
24
+ - DELETE
25
+ - PATCH
26
+
27
+ Example:
28
+
29
+ | Open browser | ${HOME_PAGE_URL} | options=${options} | |
30
+ | Input Text | id:username | foo | |
31
+ | Input Text | id:password | bar | |
32
+ | Run Async Keywords | Click Element | id:login_button | AND |
33
+ | ... | `Wait For Request Url` | ${URL_API}/login | POST |
34
+
35
+ """
15
36
return self .loop .run_until_complete (self .async_func .wait_for_request_url_async (url , method , timeout ))
16
37
17
38
@keyword
18
39
def wait_for_response_url (self , url , status = 200 , timeout = None ):
19
- """Wait for response url"""
40
+ """
41
+ Wait until web application received response from ``url``.
42
+
43
+ The ``url`` is response url.
44
+
45
+ The ``status`` is HTTP Status Codes:
46
+ - 200 (default)
47
+ - 201
48
+ - 204
49
+ - 400
50
+ - 401
51
+ - 404
52
+ - 500
53
+ Reference:[https://restfulapi.net/http-status-codes/|https://restfulapi.net/http-status-codes/]
54
+
55
+ Example:
56
+
57
+ | Open browser | ${HOME_PAGE_URL} | options=${options} | |
58
+ | Input Text | id:username | foo | |
59
+ | Input Text | id:password | bar | |
60
+ | Run Async Keywords | Click Element | id:login_button | AND |
61
+ | ... | `Wait For Response Url` | ${URL_API}/login | 200 |
62
+
63
+ """
20
64
return self .loop .run_until_complete (self .async_func .wait_for_response_url_async (url , status , timeout ))
21
65
22
66
@keyword
23
67
def wait_for_function (self , page_function ):
24
- """Wait for page trigger function"""
68
+ """
69
+ Waits until web application executes java script function.
70
+
71
+ The ``page_function`` is java script function.
72
+
73
+ """
25
74
return self .loop .run_until_complete (self .async_func .wait_for_function_async (page_function ))
26
75
27
76
@keyword
28
77
def wait_for_navigation (self ):
29
- """Wait for navigation from any redirect"""
78
+ """
79
+ Waits until web page navigates to new url or reloads.
80
+
81
+ Example:
82
+
83
+ | Open browser | ${HOME_PAGE_URL} | options=${options} | |
84
+ | Input Text | id:username | foo | |
85
+ | Input Text | id:password | bar | |
86
+ | Run Async Keywords | Click Element | id:login_button | AND |
87
+ | ... | `Wait For Navigation` | | |
88
+ """
30
89
return self .loop .run_until_complete (self .async_func .wait_for_navigation_async ())
31
90
32
91
@keyword
33
92
def wait_until_page_contains_element (self , locator , timeout = None ):
34
- """Wait until page contains element within specific timeout"""
93
+ """
94
+ Waits until ``locator`` element appears on current page.
95
+
96
+ Example:
97
+
98
+ | Open browser | ${HOME_PAGE_URL} | options=${options} |
99
+ | `Wait Until Page Contains Element` | id:username | |
100
+ """
35
101
return self .loop .run_until_complete (self .async_func .wait_for_selenium_selector (locator , timeout ))
36
102
37
103
@keyword
38
104
def wait_until_element_is_hidden (self , locator , timeout = None ):
105
+ """
106
+ Waits until ``locator`` element is hide or removed from web page.
107
+
108
+ Example:
109
+
110
+ | Run Async Keywords | Click Element | id:login_button | AND |
111
+ | ... | Wait For Navigation | | |
112
+ | `Wait Until Element Is Hidden` | id:login_button | | |
113
+ """
39
114
return self .loop .run_until_complete (self .async_func .wait_until_element_is_hidden_async (locator , timeout ))
40
115
41
116
@keyword
42
117
def wait_until_element_is_visible (self , locator , timeout = None ):
118
+ """
119
+ Waits until ``locator`` element is displayed on web page.
120
+
121
+ Example:
122
+
123
+ | Run Async Keywords | Click Element | id:login_button | AND |
124
+ | ... | Wait For Navigation | | |
125
+ | `Wait Until Element Is Visible` | id:welcome | | |
126
+ """
43
127
return self .loop .run_until_complete (self .async_func .wait_until_element_is_visible_async (locator , timeout ))
44
128
45
129
@keyword
46
130
def wait_until_page_contains (self , text , timeout = None ):
47
- """Waits until ``text`` appears on the current page"""
131
+ """
132
+ Waits until ``text`` appears on current page.
133
+
134
+ Example:
135
+
136
+ | Run Async Keywords | Click Element | id:login_button | AND |
137
+ | ... | Wait For Navigation | | |
138
+ | `Wait Until Page Contains` | Invalid user name or password | | |
139
+ """
48
140
return self .loop .run_until_complete (self .async_func .wait_until_page_contains_async (text , timeout ))
49
141
50
142
@keyword
51
143
def wait_until_page_does_not_contains (self , text , timeout = None ):
52
- """Waits until ``text`` appears on the current page"""
144
+ """
145
+ Waits until ``text`` disappears on current page.
146
+
147
+ Example:
148
+
149
+ | Run Async Keywords | Click Element | id:login_button | AND |
150
+ | ... | Wait For Navigation | | |
151
+ | `Wait Until Page Does Not Contains` | Please input your user name | | |
152
+ """
53
153
return self .loop .run_until_complete (self .async_func .wait_until_page_does_not_contains_async (text , timeout ))
54
154
55
155
@keyword
56
- def wait_until_element_contains (self , selenium_locator , text , timeout = None ):
57
- """Waits until the ``element`` contains ``text``."""
58
- return self .loop .run_until_complete (self .async_func .wait_until_element_contains_async (selenium_locator , text , timeout ))
156
+ def wait_until_element_contains (self , locator , text , timeout = None ):
157
+ """
158
+ Waits until ``locator`` element contains ``text``.
159
+
160
+ Example:
161
+
162
+ | Open browser | ${HOME_PAGE_URL} | options=${options} |
163
+ | `Wait Until Element Contains` | css:#container p | Please input your user name |
164
+ """
165
+ return self .loop .run_until_complete (self .async_func .wait_until_element_contains_async (locator , text , timeout ))
59
166
60
167
@keyword
61
- def wait_until_element_does_not_contains (self , selenium_locator , text , timeout = None ):
62
- """Waits until the ``element`` does not contains ``text``."""
63
- return self .loop .run_until_complete (self .async_func .wait_until_element_does_not_contains_async (selenium_locator , text , timeout ))
168
+ def wait_until_element_does_not_contains (self , locator , text , timeout = None ):
169
+ """
170
+ Waits until ``locator`` element does not contains ``text``.
171
+
172
+ Example:
173
+
174
+ | Run Async Keywords | Click Element | id:login_button | AND |
175
+ | ... | Wait For Navigation | | |
176
+ | `Wait Until Element Does Not Contains` | css:#container p | Please input your user name | |
177
+ """
178
+ return self .loop .run_until_complete (self .async_func .wait_until_element_does_not_contains_async (locator , text , timeout ))
64
179
0 commit comments