automationName   text         XCUITest

platformName             text           iOS

platformVersion           text          11.3

deviceName                text         iphone Simulator

app                            firepath          路径

-----------------------------------------------------------------------------------------------------

from appium import webdriver

import time

capability={

  "automationName ": "XCUITest",

  "platformName " : "iOS",

  "platformVersion " : "11.3",

  "noReset":"true",

  "deviceName " : "iphone Simulator",

  "app"        :" 路径"

}

driver=webdriver.Remote('http://127.0.0.1/wd/hub',capability)

driver.switch_to.alert.accept()

-------------------------------------------------------------------------

from appium import webdriver

import time

capability={

  "automationName ": "XCUITest",

  "platformName " : "iOS",

  "platformVersion " : "11.3",

  "noReset":"true",

  "deviceName " : "iphone Simulator",

  "app"        :" 路径"

}

driver=webdriver.Remote('http://127.0.0.1/wd/hub',capability)

driver.execute_script("mobile:scroll",{"direction":"right"})

def get_size():
size=driver.get_window_size()
width=size['width']
height=size['height']
return width,height
#向左滑动
def swipe_left():
x1=get_size()[0]/10*9
y1=get_size()[1]/2
x2=get_size()[0]/10
driver.swipe(x1,y1,x2,y1)
#向右滑动
def swipe_right():
x1=get_size()[0]/10
y1=get_size()[1]/2
x2=get_size()[0]/10*9
driver.swipe(x1,y1,x2,y1)
#向上滑动
def swipe_up():
x1=get_size()[0]/2
y=get_size()[1]/10*9
y1=get_size()[0]/10
driver.swipe(x1,y,x1,y1)
#向下滑动
def swipe_down():
x1=get_size()[0]/2
y=get_size()[1]/10
y1=get_size()[1]/10*9
driver.swipe(x1,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()
swipe_left()
driver.quit()

最新文章

  1. 让人一用钟情的VS插件系列之一——Web Essentials(Web开发必备利器)
  2. TortoiseSVN status cache占用CPU高
  3. Only top uni produces good ppt.
  4. 查询一个ID出现2种结果的情况
  5. 最简单的PHP socket echo server。
  6. OpenJudge 2792 集合加法
  7. Mysql访问权限问题:Access denied for user 'root'@'XXX' (using password: YES)
  8. 重新拾取:TFS2017钉钉机器人源代码签入通知
  9. 在windows下搭建汇编编程环境
  10. spring cloud中feign的使用
  11. 消息中间件:rabbitmq安装
  12. ubuntu下VS code如何调试C++代码
  13. centos服务重启
  14. BZOJ2337: [HNOI2011]XOR和路径(期望 高斯消元)
  15. No.1001_第六次团队会议
  16. php中heredoc的使用方法
  17. BZOJ 2131 圈地计划(最小割+黑白染色)
  18. 分布式跟踪系统zipkin+mysql
  19. 系统变量 %USERPROFILE%
  20. CQRS轻量级框架【CQRSlite】学习使用小记

热门文章

  1. java获取类名不包括路径
  2. [jQuery]ajax请求导致浏览器崩溃
  3. 苹果的编程语言--Swift
  4. SharePoint 2013 关闭 customErrors
  5. win7下code::blocks开发环境
  6. Python开发利器PyCharm 2.7附注册码
  7. Pet(dfs)
  8. html5 窗口之间的通信
  9. 爬虫框架Scrapy与Web框架Django结合
  10. golang 获取statuscode