zoukankan      html  css  js  c++  java
  • appium 简单的测试例子(1)


    #
    !/usr/bin/env python # -*- coding: utf-8 -*- from appium import webdriver import time desired_caps = {} desired_caps['platformName'] = 'android' desired_caps['platformVersion'] = '4.4.2' desired_caps['deviceName'] = '127.0.0.1:5555' desired_caps['appPackage'] = 'com.android.browser' desired_caps['appActivity'] = '.BrowserActivity' desired_caps["unicodeKeyboard"] = 'True' #声明中文 desired_caps["resetKeyboard"] = 'True' #声明中文,否则不支持中文 desired_caps['noReset']='True' #执行时不初始化 driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps) driver.find_element_by_id("com.android.browser:id/url").click() driver.find_element_by_id("com.android.browser:id/url").clear() time.sleep(3) url="http://www.baidu.com" driver.get(url) print ("chegngong")
    1,打开虚拟机上的浏览器,并且打开百度地址



    #!/usr/bin/env python
    # -*- coding: utf-8 -*-
    from appium import webdriver
    import time
    
    desired_caps = {}
    desired_caps['platformName'] = 'android'
    desired_caps['platformVersion'] = '4.4.2'
    desired_caps['deviceName'] = '127.0.0.1:5555'
    desired_caps["unicodeKeyboard"] = 'True'  #声明中文
    desired_caps["resetKeyboard"] = 'True'  #声明中文,否则不支持中文
    desired_caps['noReset'] = 'True'  #执行时不初始化
    desired_caps['appPackage'] = 'com.tencent.mobileqq'
    desired_caps['appActivity'] = '.activity.SplashActivity'
    driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
    time.sleep(1)
    time.sleep(1)
    driver.find_element_by_id("com.tencent.mobileqq:id/btn_login").click()
    time.sleep(2)
    driver.find_element_by_class_name("android.widget.EditText").send_keys("xxxxxxxx")
    driver.find_element_by_id("com.tencent.mobileqq:id/password").clear()
    driver.find_element_by_id("com.tencent.mobileqq:id/password").send_keys("xxxxxx")
    driver.find_element_by_id("com.tencent.mobileqq:id/login").click()

    1.打开虚拟机上的qq

    2.登录帐号密码







  • 相关阅读:
    win10彻底永久关闭自动更新的方法
    kibana.yml配置
    完整记录安装elasticsearch的过程
    docker下nginx的安装
    centos7删除mysql
    21 | panic函数、recover函数以及defer语句 (上)
    07 | 数组和切片
    SNAPSHOT包上传nexus成功,下载失败
    extract method(提炼函数)
    枚举中不要再出现数字了
  • 原文地址:https://www.cnblogs.com/littlefive/p/9402146.html
Copyright © 2011-2022 走看看