标签:手机 ash tomat color size pac nbsp cto nic
在android目录下找到uiautomatorviewer.bat,然后双击,页面的第二个按钮连接设备
D:\Program Files\android-sdk-windows\tools\uiautomatorviewer.bat
from appium import webdriver caps = {} caps["appPackage"] = "com.tencent.mobileqq" # caps["appPackage"] = "com.android.settings" caps["appActivity"] = "com.tencent.mobileqq.activity.SplashActivity" # caps["appActivity"] = ".Settings" caps["platformName"] = "Android" caps["platformVersion"] = ‘4.4.2‘ caps["deviceName"] = ‘127.0.0.1:62001‘ caps["unicodeKeyboard"] = True caps["resetKeyboard"] = True caps["noReset"] = True driver = webdriver.Remote("http://localhost:4723/wd/hub", caps) #获取手机大小 {‘width‘: 720, ‘height‘: 1280} size = driver.get_window_size() print(size) #如果安装了返回True print(driver.is_app_installed("com.tencent.mobileqq")) #关闭app driver.close_app() import time time.sleep(3) #启动app,启动是初始化的app driver.launch_app() #1、除默认的初始化app之外 还可以在启动其他app driver.close_app() driver.start_activity(‘com.android.settings‘, ‘.Settings‘) #2、他可以跳过某些场景,达到某个页面 # element = driver.find_element_by_android_uiautomator(‘new UiSelector().text("新用户")‘) # element.click() print(driver.current_activity) driver.start_activity(‘com.tencent.mobileqq‘, ‘.activity.RegisterPhoneNumActivity‘) print(driver.current_activity)
标签:手机 ash tomat color size pac nbsp cto nic
原文地址:https://www.cnblogs.com/xinjing-jingxin/p/9434317.html