提问人:Somu 提问时间:11/15/2023 最后编辑:Somu 更新时间:11/15/2023 访问量:14
如何处理 Appium python 脚本配置上的成功弹出消息“Provisioning Success” ok
How to Handle successful pop up message "Provisioning Success" ok on Appium python script provisioning
问:
我正在尝试从 appium python 脚本运行配置应用程序,并在连接给定 ssid 和密码的机器上连接移动设备。AP连接成功后,我们得到配置成功OK。弹出屏幕即将到来。以下是下面的代码。 但是,在 Appium Inspector 中,此“配置成功”按钮是可单击的 false。尝试过 xpath driver.find_element(by=AppiumBy.XPATH, value=“//android.widget.TextView[@text='配置成功']”).click()
def perform_provision(self):
# Desired Capabilities
desired_cap = {
"platformName": "Android",
"platformVersion": "11",
"deviceName": "RZ8M71M2E9X",
"appPackage": "com.innophase.provisioning",
"appActivity": ".MainActivity",
"automationName": "UiAutomator2",
"noReset": "true",
"appium:connect_timeout": 30
}
#Initialize the driver
options = UiAutomator2Options().load_capabilities(desired_cap)
driver = webdriver.Remote("http://0.0.0.0:4723/wd/hub", options=options)
time.sleep(5)
print("Launching BLE Provisioning app")
time.sleep(10)
print("Clicking on scan now !")
driver.find_element(by=AppiumBy.XPATH, value="/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.widget.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[2]").click()
time.sleep(10)
driver.find_element(by=AppiumBy.XPATH, value="//android.widget.TextView[@text='DualStack1']").click()
print("Selecting the device")
#time.sleep(10)
driver.implicitly_wait(10)
ssid=driver.find_element(by=AppiumBy.XPATH, value="//android.widget.TextView[contains(@text,'DualStack2')]").click()
driver.implicitly_wait(10)
driver.find_element(by=AppiumBy.XPATH, value="//android.widget.EditText[@text='Password']").send_keys("InnoQA2023$")
time.sleep(10)
driver.find_element(by=AppiumBy.XPATH, value="//android.widget.TextView[@text='Submit']").click()
print("Provisioning done successfully")
time.sleep(12)
driver.find_element(by=AppiumBy.XPATH, value="//android.widget.TextView[@text='Provisioning Success']").click()
看到此错误 Traceback (最近一次调用最后一次): 文件“/home/admin1/Desktop/temp_soma/test-automation-master-iot/./test_cases/DualStack/Wifi_provision.py”,第 144 行,在 test.perform_provision() 文件“/home/admin1/Desktop/temp_soma/test-automation-master-iot/./lib/BLE_Provisioning.py”,第 48 行,在 perform_provision 中 ssid=driver.find_element(by=AppiumBy.XPATH, value=“//android.widget.TextView[contains(@text,'DualStack2')]”).click() 文件“/usr/local/lib/python3.10/dist-packages/appium/webdriver/webdriver.py”,第 381 行,find_element 返回 self.execute(RemoteCommand.FIND_ELEMENT, {'using': by, 'value': value})['value'] 文件“/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py”,第 344 行,正在执行 self.error_handler.check_response(响应) 文件“/usr/local/lib/python3.10/dist-packages/appium/webdriver/errorhandler.py”,第 125 行,check_response 引发exception_class(msg=message, stacktrace=format_stacktrace(stacktrace)) selenium.common.exceptions.NoSuchElementException:消息:使用给定的搜索参数无法在页面上找到元素。;有关此错误的文档,请访问: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception Stacktrace:
答: 暂无答案
评论