adb如何连接mumu模拟器
adb如何连接mumu模拟器
【win版】
adb connect 127.0.0.1:7555
adb shell
如果在本地配置安装了appium测试环境,运行即可验证
# coding=utf-8 # 模拟移动端首次安装手指滑动操作 from appium import webdriver def get_driver(): capabilities = { "platformName": "Android", "platformVersion": "6.0.1", # "deviceName": "bd619e047cf3", "deviceName": "127.0.0.1:7555", "app": "D:\\Android\\open_mooc_701_.apk", # "appPackage":新版Appium1.19.1无需手动配置 # "appActivity":新版Appium1.19.1无需手动配置 "appPackage":"cn.com.open.mooc", "appWaitActivity": "com.imooc.component.imoocmain.splash.GuideActivity" } driver = webdriver.Remote("http://127.0.0.1:4723/wd/hub", capabilities) return driver # driver.swipe(x,y,x1,y1) # driver.swipe(500,400,50,400) #水平从右向左滑动 # 获取屏幕像素的宽和高 # size = driver.get_window_size() # width = size['width'] # height = size['height'] # 获取屏幕像素宽和高,方法封装 def get_size(): # driver = get_driver() size = driver.get_window_size() width = size['width'] height = size['height'] return width, height # 手指向左滑动,方法封装 def swipe_left(): x = get_size()[0] / 10 * 9 y1 = get_size()[1] / 2 x1 = get_size()[0] / 10 # driver = get_driver() driver.swipe(x, y1, x1, y1) # 手指向右滑动,方法封装 def swipe_right(): x = get_size()[0] / 10 y1 = get_size()[1] / 2 x1 = get_size()[0] / 10 * 9 # driver = get_driver() driver.swipe(x, y1, x1, y1) # 手指向上滑动,方法封装 def swipe_up(): x = get_size()[0] / 2 y = get_size()[1] / 10 * 9 y1 = get_size()[1] / 10 x1 = get_size()[0] / 2 # driver = get_driver() driver.swipe(x, y, x1, y1) # 手指向下滑动,方法封装 def swipe_down(): x = get_size()[0] / 2 y = get_size()[1] / 10 y1 = get_size()[1] / 10 * 9 x1 = get_size()[0] / 2 # driver = get_driver() driver.swipe(x, y, x1, y1) # 进一步封装,滑动的方法 def swipe_on(direction): if direction == 'up': swipe_up() elif direction == 'down': swipe_down() elif direction == 'left': swipe_left() else: swipe_right() if __name__ == '__main__': driver = get_driver() #获取一个全局变量 swipe_on('left') swipe_on('left')
部分内容来自于学习编程期间收集于网络的免费分享资源和工作后购买的付费内容。
如需获取教程配套的资源文件和一对一专属答疑支持,请加vx:kangmf24联系作者。