Skip to content

Commit 7bdca3c

Browse files
committed
Added keyword documentation for new Wait For Expected Condition keyword
1 parent d23700e commit 7bdca3c

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/SeleniumLibrary/keywords/expectedconditions.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,32 @@
2222
class ExpectedConditionKeywords(LibraryComponent):
2323
@keyword
2424
def wait_for_expected_condition(self, condition: string, *args, timeout: Optional[float]=10):
25+
"""Waits until ``condition`` is true or ``timeout`` expires.
26+
27+
The condition must be one of selenium's expected condition which
28+
can be found within the selenium
29+
[https://www.selenium.dev/selenium/docs/api/py/webdriver_support/selenium.webdriver.support.expected_conditions.html#module-selenium.webdriver.support.expected_conditions Python API]
30+
documentation. The expected condition can written as snake_case
31+
(ex title_is) or it can be space delimited (ex Title Is). Some
32+
conditions require additional arguments or ``args`` which should
33+
be passed along after the expected condition.
34+
35+
Fails if the timeout expires before the condition becomes true.
36+
The default value is 10 seconds.
37+
38+
Examples:
39+
| `Wait For Expected Condition` | alert_is_present |
40+
| `Wait For Expected Condition` | Title Is | New Title |
41+
42+
If the expected condition expects a locator then one can pass
43+
as arguments a tuple containing the selenium locator strategies
44+
and the locator.
45+
46+
Example of expected condition expecting locator:
47+
| ${byElem}= | Evaluate ("id","added_btn")
48+
| `Wait For Expected Condition` | Presence Of Element Located | ${byElem}
49+
"""
50+
2551
condition = self._parse_condition(condition)
2652
wait = WebDriverWait(self.driver, timeout, 0.1)
2753
try:

0 commit comments

Comments
 (0)