Skip to content

Commit 3da5e50

Browse files
author
Cleverson Sampaio
committed
feat(findelements): added element wait
added wait for element to appear or disappear
1 parent 6b2dac2 commit 3da5e50

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
#
4+
# Copyright (c) 2022 Cléverson Sampaio <cleverson@sampaio.dev.br>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
#
4+
# Copyright (c) 2022 Cléverson Sampaio <cleverson@sampaio.dev.br>
5+
6+
from robot.libraries.BuiltIn import BuiltIn
7+
from robot.api.deco import keyword
8+
from SeleniumLibraryExtends.report import Report
9+
10+
class FindElements:
11+
def __init__(self):
12+
pass
13+
14+
@keyword("I wait for the ${locator} element to be visible")
15+
def waitForElementVisible(self, locator: str):
16+
self.driver = BuiltIn().get_library_instance("SeleniumLibrary")
17+
try:
18+
self.driver.wait_until_element_is_visible(locator)
19+
except Exception as e:
20+
Report().fail(e)
21+
22+
@keyword("I wait for the ${locator} element not to be visible")
23+
def waitForElementNotVisible(self, locator: str):
24+
self.driver = BuiltIn().get_library_instance("SeleniumLibrary")
25+
try:
26+
self.driver.wait_until_element_is_not_visible(locator)
27+
except Exception as e:
28+
Report().fail(e)

0 commit comments

Comments
 (0)