Skip to content

Commit

Permalink
Clean common.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ericbsd committed Jun 6, 2024
1 parent 1321a2d commit d30d2b7
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions keywords/webui/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
from pathlib import Path

from selenium.common.exceptions import (
NoSuchElementException,
TimeoutException,
ElementClickInterceptedException,
StaleElementReferenceException
ElementClickInterceptedException
)
from selenium.webdriver.common.keys import Keys

Expand Down Expand Up @@ -1070,8 +1068,7 @@ def is_row_visible(cls, name) -> bool:
Example:
- Common.is_row_visible('save')
"""
xpath = f'//*[@data-test="row-{cls.convert_to_tag_format(name)}"]'
return WebUI.wait_until_visible(xpath, shared_config['SHORT_WAIT'])
return cls.is_visible(f'//*[@data-test="row-{cls.convert_to_tag_format(name)}"]')

@classmethod
def is_select_visible(cls, name) -> bool:
Expand Down Expand Up @@ -1149,20 +1146,8 @@ def is_visible(cls, xpath: str, wait: int = shared_config['SHORT_WAIT']) -> bool
Example:
- Common.is_visible('myXpath')
- Common.is_visible('myXpath', shared_config['MEDIUM_WAIT'])
"""
# obj = None
# result = False
# try:
# obj = WebUI.xpath(xpath)
# result = obj.is_displayed()
# except (NoSuchElementException, StaleElementReferenceException):
# return Falseobj = None
# result = False
# try:
# obj = WebUI.xpath(xpath)
# result = obj.is_displayed()
# except (NoSuchElementException, StaleElementReferenceException):
# return False
return WebUI.wait_until_visible(xpath, wait)

@classmethod
Expand Down Expand Up @@ -1620,5 +1605,7 @@ def wait_for_system_time(cls, time: str, value: int) -> None:
pause = 86400

while cls.get_current_time_element(time) < value:
print("@@@ WAIT FOR: " + str(cls.get_current_time_element(time)) + " to be: " + str(value))
print(
f"@@@ WAIT FOR: {str(cls.get_current_time_element(time))} to be: {value}"
)
WebUI.delay(pause)

0 comments on commit d30d2b7

Please sign in to comment.