Skip to content

Commit

Permalink
Added Webdriverwait in get_url with some trying.
Browse files Browse the repository at this point in the history
  • Loading branch information
renanllisboa committed Dec 1, 2023
1 parent 3731f3f commit 073927c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tir/technologies/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1170,15 +1170,17 @@ def get_url(self, url=None):

url = self.config.url if not url else url

endtime = time.time() + self.config.time_out
while (time.time() < endtime and not get_url):

logger().debug('Get URL')
num_of_trying = 1
while not get_url and num_of_trying <= 5:
self.driver.get(url)
try:
self.driver.get(url)
WebDriverWait(self.driver, int(self.config.time_out / num_of_trying)).until(EC.presence_of_element_located((By.ID, 'fieldsetStartProg')))
logger().info("Page is ready!")
get_url = True
break
except:
get_url = False
num_of_trying += 1
logger().info(f"Loading took too much time! num_of_trying: {str(num_of_trying)}")

def TearDown(self):
"""
Expand Down

0 comments on commit 073927c

Please sign in to comment.