2000字范文,分享全网优秀范文,学习好帮手!
2000字范文 > 自动化测试之ios测试脚本

自动化测试之ios测试脚本

时间:2021-01-21 04:00:42

相关推荐

自动化测试之ios测试脚本

一、连接手机,安装App

首先要开启一个appium服务

appium --no-reset -p 4724 --session-override,端口号和脚本中的端口号一致

def __init__(self):desired_caps = {}desired_caps['app'] = appDirdesired_caps['deviceName'] = "iPhone 7P"desired_caps['platformName'] = "IOS"desired_caps['platformVersion'] = '13.5.1'desired_caps['udid'] = "xxxxxxxxx"desired_caps['automationName'] = 'XCUITest'desired_caps['xcodeOrgId'] = "xxxxxx"desired_caps['xcodeSigningId'] = "iPhone Developer"desired_caps['noReset'] = Falsedesired_caps['locationServicesEnabled'] = Truedesired_caps['locationServicesAuthorized'] = Truedesired_caps['showiOSLog'] = Trueself.driver = webdriver.Remote(command_executor="http://127.0.0.1:4724/wd/hub", desired_capabilities=desired_caps)

其中:

appDir app的路径

udid 手机的udid

xcodeOrgId 开发者id

noReset false为每次运行脚本都会重置App,即卸载后重置

二、运行App

1.一般第一次打开会申请一些权限

if self.elementExist(By.NAME, "允许"):self.driver.find_element_by_name("允许").click()if self.elementExist(By.NAME, "使用App时允许"):self.driver.find_element_by_name("使用App时允许").click()if self.elementExist(By.NAME, "允许"):self.driver.find_element_by_name("允许").click()```

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。