Appium的ios配置
Posted taotao12
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Appium的ios配置相关的知识,希望对你有一定的参考价值。
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配置的主要内容,如果未能解决你的问题,请参考以下文章