zoukankan      html  css  js  c++  java
  • Appium环境搭建(二)

    8.测试脚本

    (1)  打开SDK Manager.exe ->打开 Android Virtual Device Manager->创建模拟器->Start

          

    (2)   对模拟器中“计算器”进行加法操作

      打开”python”->”IDLE”新建脚本

      #coding=utf-8

      from appium import webdriver

      from appium.webdriver.mobilecommand import MobileCommand

      import time

      import os

      desired_caps = {}

      desired_caps['platformName'] = 'Android'

      desired_caps['platformVersion'] = '4.4.2'

      desired_caps['deviceName'] = 'emulator-5554'

      desired_caps['appPackage'] = 'com.android.calculator2'  #被测App的包名

      desired_caps['appActivity'] = '.Calculator' #启动时的Activity

      desired_caps['unicodeKeyboard'] = True

      desired_caps['resetKeyboard'] = True

      desired_caps['newCommandTimeout'] = 7200

      driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)

      driver.find_element_by_id("com.android.calculator2:id/digit2").click()

      driver.find_element_by_id("com.android.calculator2:id/plus").click()

      driver.find_element_by_id("com.android.calculator2:id/digit4").click()

      driver.find_element_by_id("com.android.calculator2:id/equal").click()

         driver.quit()

    (3)打开->Android Settings进行设置

         

    (4)启动Appium-server->运行脚本

    欢迎加入交流群:Selenium学习群: 628908894
  • 相关阅读:
    继承
    对象与类
    反射
    I/O流
    字符串
    Map的entrySet()方法
    接口与内部类
    Git Usage Summary
    HTML(5)
    毕业设计:下载
  • 原文地址:https://www.cnblogs.com/tim2016/p/5748387.html
Copyright © 2011-2022 走看看