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配置

上一篇:Android Studio 调试vivo x9


下一篇:移动端响应式