码迷,mamicode.com
首页 > 移动开发 > 详细

Appium的ios配置

时间:2018-10-09 23:11:45      阅读:312      评论:0      收藏:0      [点我收藏+]

标签:abi   tor   hone   reset   imu   path   配置   scroll   bdr   

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()

Appium的ios配置

标签:abi   tor   hone   reset   imu   path   配置   scroll   bdr   

原文地址:https://www.cnblogs.com/xuzhongtao/p/9763686.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!