Skip to content

Commit 41147dc

Browse files
Refactor loading state handling in PouiInternal to use a selector parameter and simplify waiting logic
1 parent 82e5ed1 commit 41147dc

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

tir/technologies/poui_internal.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3748,18 +3748,10 @@ def po_loading(self, selector=''):
37483748

37493749
logger().info("Waiting loading...")
37503750

3751-
loading = True
3751+
main_container = selector or 'body'
37523752

3753-
endtime = time.time() + 300
3754-
while loading and time.time() < endtime:
3755-
if selector:
3756-
container = self.web_scrap(term=selector, scrap_type=enum.ScrapType.CSS_SELECTOR,
3757-
main_container='body')
3758-
else:
3759-
container = self.get_current_DOM(twebview=True)
3760-
container = [container]
3761-
3762-
loading = True if list(filter(lambda x: x.select('po-loading'), container)) else False
3753+
self.wait_element(term='po-loading', scrap_type=enum.ScrapType.CSS_SELECTOR,
3754+
presence=False, main_container=main_container)
37633755

37643756
logger().info("Loading finished!")
37653757

0 commit comments

Comments
 (0)