diff --git a/libs/perfecto_libs/iOS_lib.py b/libs/perfecto_libs/iOS_lib.py index 67c698d6a..bb7946cdf 100644 --- a/libs/perfecto_libs/iOS_lib.py +++ b/libs/perfecto_libs/iOS_lib.py @@ -1023,7 +1023,7 @@ def get_ip_address_ios(request, WifiName, WifiPass, setup_perfectoMobile, connDa available_ssids = get_all_available_ssids(driver) allure.attach(name="Available SSIDs in device: ", body=str(available_ssids)) try: - if WifiName not in available_ssids: + if (not ssid_Visible(driver, WifiName)) or (WifiName not in available_ssids): scrollDown(setup_perfectoMobile) time.sleep(2) else: @@ -1790,7 +1790,7 @@ def get_ip_address_eap_ios(request, WifiName, User, ttls_passwd, setup_perfectoM available_ssids = get_all_available_ssids(driver) allure.attach(name="Available SSIDs in device: ", body=str(available_ssids)) try: - if WifiName not in available_ssids: + if (not ssid_Visible(driver, WifiName)) or (WifiName not in available_ssids): scrollDown(setup_perfectoMobile) time.sleep(2) else: @@ -2470,6 +2470,18 @@ def captive_portal_ios(request, WifiName, WifiPass, setup_perfectoMobile, connDa # --------------------- close app------------------------------- #closeApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile) return ip_address_element_text, is_internet + +# Returns whether the ssid is currently visible +def ssid_Visible(driver,WifiName): + wifiSelectionElement = WebDriverWait(driver, 30).until( + EC.presence_of_element_located((MobileBy.XPATH, "//*[@label='" + WifiName + "']"))) + isVisible = wifiSelectionElement.get_attribute("visible") + print(f"Is ssid visible: {isVisible}") + if(isVisible == 'false'): + return False + else: + return True + #--------------------------------Gets ip address from ssid but it won't get disconnected from it------------------ def get_ip_add_ios(request, WifiName, WifiPass, setup_perfectoMobile, connData): print("\n-------------------------------------")