from appium import webdriver import time import pytest from appium.webdriver.common.touch_action import TouchAction desired_caps = {} desired_caps['platformName'] = 'Android' desired_caps['platformVersion'] = '10' desired_caps['deviceName'] = 'PKT4C20331005873' desired_caps['appPackage'] = 'com.iotsolution.arnoo' desired_caps['appActivity'] = 'haveble.BLEMainActivity' driver = webdriver.Remote('http://127.0.0.1:4722/wd/hub', desired_caps) time.sleep(2) # 位置权限,点击 el1 = driver.find_element_by_id("com.android.permissioncontroller:id/permission_allow_foreground_only_button") el1.click() time.sleep(1) # 其它,点击 TouchAction(driver).tap(x=995, y=867).perform() time.sleep(1)
# 点击“F” TouchAction(driver).tap(x=1038, y=914).perform() # 点击“France” time.sleep(1) TouchAction(driver).tap(x=145, y=730).perform() time.sleep(2) # 点击“确认切换” TouchAction(driver).tap(x=732, y=1303).perform()
# 输入邮箱地址 driver.find_element_by_xpath("//android.view.View/android.view.View[1]/android.view.View[3]/android.widget.EditText[1]").send_keys("123@qq.com") # 输入密码 driver.find_element_by_xpath("//android.widget.EditText[@text='密码']").send_keys("Asdf1234") # 点击登录 el2 = driver.find_element_by_xpath("/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View/android.view.View/android.view.View/android.view.View/android.view.View[2]/android.view.View[9]") el2.click() 切换到区域,选择别的区域后,回到登录界面就无法输入邮箱地址和密码,没有到切换区域界面时,邮箱地址和密码是可以正常输入的,判断是切换界面后没有刷新,但是不知道该如何刷新当前界面重新定位,请大家帮忙在我的代码上进行补充,谢谢!
pycharm APP UI测试时,切换区域界面再回到登录界面后,账号密码无法输入
最新推荐文章于 2024-04-04 15:00:58 发布