python--编写用例脚本

from appium import webdriver
import time

desired_caps = {}
desired_caps[‘platformName‘] = ‘Android‘
desired_caps[‘platformVersion‘] = ‘4.4.2‘
desired_caps[‘deviceName‘] = ‘test1‘
desired_caps[‘appPackage‘] = ‘com.xxxxx‘
desired_caps[‘appActivity‘] = ‘.xxxx‘

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

#在输入框中输入值

driver.find_element_by_class_name("xxx.EditText").send_keys("xxx")

#点击事件
driver.find_element_by_id("xxx").click()

# login
driver.find_element_by_id("xxx").click()

#等待2秒

time.sleep(2)

# massage
driver.find_element_by_id("xxx").click()
driver.find_element_by_id("xxx").click()

#退出app
driver.quit()

时间: 2024-07-29 23:36:21

python--编写用例脚本的相关文章

python编写文件统计脚本

思路:用os模块中的一些函数(os.listdir().os.path.isdir().os.path.join().os.path.abspath()等) 实现功能:显示多级目录,以及自己要找的具体文件类型(例:以".py"结尾的文件),并读取每个文件的第一行(一般为注释说明,这样就能大致了解这个文件是干事什么的) 先编写二级目录文件统计脚本 代码如下: #文件统计 os.chdir("F:\\pythonstudy") for fp in os.listdir(

Python编写的memcached启动脚本

Python编写memcached启动脚本 一.rc 脚本的start.stop.restart.status方法 #/usr/bin/env python # -*- coding:utf-8 -*- # @time   :2018/1/12 19:11 # @Author :FengXiaoqing # @file   :rc.py import os import sys from subprocess import Popen,PIPE class Process(object):   

Python中的类方法及属性总结举例,编写memcached启动脚本举例

1.类的属性总结类属性,也是公有属性, 类的私有属性, 对象的共有属性, 对象的私有属性, 内置属性, 函数的局部变量, 全局变量, #/usr/bin/env python # -*- coding:utf-8 -*- class MyClass(object): var1 = '类属性,类的公有属性 var1' __var2 = '类的私有属性 __var2' def func1(self): self.var3 = '对象的公有属性 var3' self.__var4 = '对象的私有属性

[简明python教程]学习笔记之编写简单备份脚本

[[email protected] 0503]# cat backup_ver3.py #!/usr/bin/python #filename:backup_ver3.py import os import time #source source=['/root/a.sh','/root/b.sh','/root/c.sh'] #source='/root/c.sh' #backup dir target_dir='/tmp/' today=target_dir+time.strftime('

Python - 利用python编写的memcached启动脚本

memcached作为缓存文件服务,默认是操作系统里面是可以直接yum -y install memcached进行安装的. /etc/init.d/memcached 是属于系统shell编写的管理脚本,下面这个脚本是python脚本编写出来的memcached管理脚本,和shell编写的脚本实现的效果一样. #!/usr/bin/python import sys import os from subprocess import Popen,PIPE class Process(object

python编写网络抓包分析脚本

python编写网络抓包分析脚本 写网络抓包分析脚本,一个称手的sniffer工具是必不可少的,我习惯用Ethereal,简单,易用,基于winpcap的一个开源的软件 Ethereal自带许多协议的 decoder,但是它的架构并不灵活,如果你要加入一个自己定义的的解码器,得去修改Ethereal的代码,再重新编译,相当的烦琐 对于一般的明文协议,没有什么问题,但是对于加密协议,比如网络游戏,客户端程序一般会在刚连接上的时候,发送一个随机密钥,而后的报文都会用这个密钥进 行加密,诸如此类.要想

用python编写ios工程自动编译、打包ipa等脚本

第一次使用python请先看:http://my.oschina.net/LangZiAiFer/blog/298763 代码管理我用的是Git: 工程clone如下: def gitClone(): os.system ('git clone https://[email protected]/xxx/goccia.git ~/desktop/20140804') return https://[email protected]/xxx/goccia.git是git服务器路径,不必care:~

使用python编写appium用例

安装Python依赖 pip3.4 install nose pip3.4 install selenium pip3.4 install Appium-Python-Client 运行测试用例android_contacts.py import os import unittest from appium import webdriver from time import sleep # Returns abs path relative to this file and not cwd PA

python编写shell脚本详细讲解

今天需要编写一个shell脚本实现App自动生成的功能,需要处理HTTP REST请求,解析JSON,处理文件,执行命令等,本来想用shell搞定,但感觉比较麻烦,还是用python吧,虽然以前用Python都是在树莓派上玩的,多尝试一种方法总是好的. 虽然我受linux的影响甚深,但是对于*nix 里随处可见的sh脚本却是讨厌之极.为什么讨厌呢?首先是因为sh脚本那莫名其妙的语法,感觉就像随写随扔的程序,完全没有任何美感可言.其次是sh脚本的处理能力还是比较弱的,在文本处理.XML处理还有网络

php、python、ruby——web脚本语言的比较

原文地址:http://klau.si/php-vs-python-vs-ruby 摘要 在过去几年里,在web应用程序编程中,脚本语言变得越来越受欢迎.本论文试图在如今三种最受欢迎的语言:PHP.Python和Ruby中找到其中的差异.优点.缺点.很明显,他们有他们自己的观点和支持,所以要陈述客观事实并满足一种科学的方法是一项困难的任务.这三种语言将在web应用程序环境进行有关历史.进化.流行程度.语法.语义.功能.安全性和性能方面做评估.最后,一个最终的结论将建议最有前途的一种语言. 1.介