zoukankan      html  css  js  c++  java
  • appium环境搭建、运行第一个python脚本

    1、下载安装Android studio

    下载链接:https://developer.android.google.cn/studio/

    安装方法连接:https://blog.csdn.net/qq_41976613/article/details/91432304

    2、配置andriod 环境变量

    验证方法:cmd命令窗口输入“adb"

     3、下载安装appium desktop

    下载地址:https://github.com/appium/appium-desktop

    安装方法:cmd 命令窗口输入”pip install Appium-Python-Client"

    4、尝试监听Adriod 模拟器

    方法:1、启动Adriod模拟器

              2、cmd窗口输入“adb devices"

    appium:
    查看platformVersion: adb shell getprop ro.build.version.release
    查看deviceName: adb devices -l
    先运行应用,然后查看appPackage以及appActivity: adb shell dumpsys activity| findstr "mResume"

    # This sample code uses the Appium python client
    # pip install Appium-Python-Client
    # Then you can paste this into a file and simply run with Python
    
    from appium import webdriver
    from appium.webdriver.common.touch_action import TouchAction
    from time import sleep
    
    caps = {}
    caps["platformName"] = "Android"
    caps["platformVersion"] = "11"
    caps["deviceName"] = "emulator-5554"
    caps["automationName"] = "appium"
    caps["ensureWebviewsHavePages"] = True
    
    driver = webdriver.Remote("http://localhost:4723/wd/hub", caps)
    
    TouchAction(driver).tap(x=128, y=1474).perform()
    TouchAction(driver).tap(x=598, y=1093).perform()
    sleep(2)
    
    driver.quit()

    运行代码前:                                                                       

      运行代码后:

  • 相关阅读:
    Performance and Design
    返回数组中不重复的元素
    IE的button元素bug
    (转)Google Closure: 糟糕的JavaScript
    Why do we have an IMG element?
    About this and that
    C#中的Attribute
    C#检查字体是否存储,以及安装
    ZipFile压缩文件后,解压文件后有多层目录的处理方法
    Office系列在线预览
  • 原文地址:https://www.cnblogs.com/yijierui/p/13617721.html
Copyright © 2011-2022 走看看