From 4b54ab7b32389106390e0c39d87b5e37667a052d Mon Sep 17 00:00:00 2001 From: haricharan-jaka Date: Wed, 15 Dec 2021 19:26:54 +0530 Subject: [PATCH] Added webdriver wait --- libs/perfecto_libs/android_lib.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libs/perfecto_libs/android_lib.py b/libs/perfecto_libs/android_lib.py index a1d7cd330..ef5cb81f6 100644 --- a/libs/perfecto_libs/android_lib.py +++ b/libs/perfecto_libs/android_lib.py @@ -1261,10 +1261,11 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa #Click on connect button # ------------------------------------------------------- try: - time.sleep(5) + # time.sleep(5) report.step_start("Click Connect Button") print("Click Connect") - joinBTNElement = driver.find_element_by_xpath("//*[@text='Connect']") + joinBTNElement =WebDriverWait(driver, 10).until( + EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='Connect']']"))) joinBTNElement.click() except NoSuchElementException: print("Connect Button Not Enabled...Verify if Password is set properly ") @@ -1568,8 +1569,9 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa # ------------------------------------------------------- try: report.step_start("Click Connect Button") - time.sleep(5) - joinBTNElement = driver.find_element_by_xpath("//*[@text='Connect']") + # time.sleep(5) + joinBTNElement = WebDriverWait(driver, 10).until( + EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='Connect']']"))) joinBTNElement.click() except NoSuchElementException: print("Connect Button Not Enabled...Verify if Password is set properly ")