From 226461ace9b801fa3422a1092ed6743f64106bd3 Mon Sep 17 00:00:00 2001 From: sushant Date: Mon, 13 Dec 2021 22:34:30 +0530 Subject: [PATCH] - commented wifi-switch logic - wifi will not be turned off at end of testcases now Signed-off-by: Sushant Bawiskar --- libs/perfecto_libs/android_lib.py | 36 ++++---- libs/perfecto_libs/iOS_lib.py | 144 +++++++++++++++--------------- 2 files changed, 90 insertions(+), 90 deletions(-) diff --git a/libs/perfecto_libs/android_lib.py b/libs/perfecto_libs/android_lib.py index 56d318b3a..c6a39792d 100644 --- a/libs/perfecto_libs/android_lib.py +++ b/libs/perfecto_libs/android_lib.py @@ -1358,15 +1358,15 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa print("Forgetting ssid") #------------------------------- Wifi Switch ---------------- - try: - print("clicking on wifi switch") - get_switch_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_widget']") - driver.implicitly_wait(2) - get_switch_element.click() - except: - print("couldn't click on wifi switch") - #allure.attach(name= body=str("couldn't click on wifi switch")) + # try: + # print("clicking on wifi switch") + # get_switch_element = driver.find_element_by_xpath( + # "//*[@resource-id='com.android.settings:id/switch_widget']") + # driver.implicitly_wait(2) + # get_switch_element.click() + # except: + # print("couldn't click on wifi switch") + # #allure.attach(name= body=str("couldn't click on wifi switch")) except: print("Couldn't forget ssid") # closeApp(connData["appPackage-android"], setup_perfectoMobile) @@ -2381,15 +2381,15 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM print("Forgetting ssid") #------------------------------- Wifi Switch ---------------- - try: - print("clicking on wifi switch") - get_switch_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_widget']") - driver.implicitly_wait(2) - get_switch_element.click() - except: - print("couldn't click on wifi switch") - #allure.attach(name= body=str("couldn't click on wifi switch")) + # try: + # print("clicking on wifi switch") + # get_switch_element = driver.find_element_by_xpath( + # "//*[@resource-id='com.android.settings:id/switch_widget']") + # driver.implicitly_wait(2) + # get_switch_element.click() + # except: + # print("couldn't click on wifi switch") + # #allure.attach(name= body=str("couldn't click on wifi switch")) except: print("Couldn't forget ssid") # closeApp(connData["appPackage-android"], setup_perfectoMobile) diff --git a/libs/perfecto_libs/iOS_lib.py b/libs/perfecto_libs/iOS_lib.py index f9e9cde05..c6435fc04 100644 --- a/libs/perfecto_libs/iOS_lib.py +++ b/libs/perfecto_libs/iOS_lib.py @@ -1121,42 +1121,42 @@ def get_ip_address_ios(request, WifiName, WifiPass, setup_perfectoMobile, connDa print("error on ssid element") # --------------------To Turn on WIFi Switch if already OFF-------------------------------- - try: - get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='1']") - get_wifi_switch_element_text = get_wifi_switch_element.text - print("switch state is : ", get_wifi_switch_element_text) - try: - if get_wifi_switch_element_text == "1" or get_wifi_switch_element_text == 1: - get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='1']") - driver.implicitly_wait(1) - get_wifi_switch_element.click() - driver.implicitly_wait(1) - i = 0 - for i in range(5): - try: - get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='0']") - get_wifi_switch_element_text = get_wifi_switch_element.text - except: - print("switch is ON") - - if get_wifi_switch_element_text == "0" or get_wifi_switch_element_text == 0: - print("WIFI Switch is OFF") - break - else: - try: - get_wifi_switch_element = driver.find_element_by_xpath( - "//*[@label='Wi-Fi' and @value='1']") - get_wifi_switch_element.click() - get_wifi_switch_element_text = get_wifi_switch_element.text - except: - print("WIFi switch is OFF") - - else: - print("Switch is Still OFF") - except: - pass - except: - print("get_wifi_switch_element is ON") + # try: + # get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='1']") + # get_wifi_switch_element_text = get_wifi_switch_element.text + # print("switch state is : ", get_wifi_switch_element_text) + # try: + # if get_wifi_switch_element_text == "1" or get_wifi_switch_element_text == 1: + # get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='1']") + # driver.implicitly_wait(1) + # get_wifi_switch_element.click() + # driver.implicitly_wait(1) + # i = 0 + # for i in range(5): + # try: + # get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='0']") + # get_wifi_switch_element_text = get_wifi_switch_element.text + # except: + # print("switch is ON") + # + # if get_wifi_switch_element_text == "0" or get_wifi_switch_element_text == 0: + # print("WIFI Switch is OFF") + # break + # else: + # try: + # get_wifi_switch_element = driver.find_element_by_xpath( + # "//*[@label='Wi-Fi' and @value='1']") + # get_wifi_switch_element.click() + # get_wifi_switch_element_text = get_wifi_switch_element.text + # except: + # print("WIFi switch is OFF") + # + # else: + # print("Switch is Still OFF") + # except: + # pass + # except: + # print("get_wifi_switch_element is ON") # --------------------To Turn on WIFi Switch if already OFF-------------------------------- except Exception as e: @@ -1866,42 +1866,42 @@ def get_ip_address_eap_ios(request, WifiName, User, ttls_passwd, setup_perfectoM print("error on ssid element") # --------------------To Turn on WIFi Switch if already OFF-------------------------------- - try: - get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='1']") - get_wifi_switch_element_text = get_wifi_switch_element.text - print("switch state is : ", get_wifi_switch_element_text) - try: - if get_wifi_switch_element_text == "1" or get_wifi_switch_element_text == 1: - get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='1']") - driver.implicitly_wait(1) - get_wifi_switch_element.click() - driver.implicitly_wait(1) - i = 0 - for i in range(5): - try: - get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='0']") - get_wifi_switch_element_text = get_wifi_switch_element.text - except: - print("switch is ON") - - if get_wifi_switch_element_text == "0" or get_wifi_switch_element_text == 0: - print("WIFI Switch is OFF") - break - else: - try: - get_wifi_switch_element = driver.find_element_by_xpath( - "//*[@label='Wi-Fi' and @value='1']") - get_wifi_switch_element.click() - get_wifi_switch_element_text = get_wifi_switch_element.text - except: - print("WIFi switch is OFF") - - else: - print("Switch is Still OFF") - except: - pass - except: - print("get_wifi_switch_element is ON") + # try: + # get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='1']") + # get_wifi_switch_element_text = get_wifi_switch_element.text + # print("switch state is : ", get_wifi_switch_element_text) + # try: + # if get_wifi_switch_element_text == "1" or get_wifi_switch_element_text == 1: + # get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='1']") + # driver.implicitly_wait(1) + # get_wifi_switch_element.click() + # driver.implicitly_wait(1) + # i = 0 + # for i in range(5): + # try: + # get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='0']") + # get_wifi_switch_element_text = get_wifi_switch_element.text + # except: + # print("switch is ON") + # + # if get_wifi_switch_element_text == "0" or get_wifi_switch_element_text == 0: + # print("WIFI Switch is OFF") + # break + # else: + # try: + # get_wifi_switch_element = driver.find_element_by_xpath( + # "//*[@label='Wi-Fi' and @value='1']") + # get_wifi_switch_element.click() + # get_wifi_switch_element_text = get_wifi_switch_element.text + # except: + # print("WIFi switch is OFF") + # + # else: + # print("Switch is Still OFF") + # except: + # pass + # except: + # print("get_wifi_switch_element is ON") # --------------------To Turn on WIFi Switch if already OFF-------------------------------- except Exception as e: