Appium定义接口测试

1.Appium如何执行

  Appium作为一个服务器,python的脚本代码交给Appium服务器,Appium再去与设备交互。

  

  desired_cap = {}
  desired_cap['platformName'] = 'Android'
  desired_cap['deviceName'] = 'Android Emulator'

  # 指定自动化引擎
  # desired_cap['automationName'] = 'Appium'
  desired_cap['automationName'] = 'Selendroid'


  desired_cap['appPackage'] = 'io.selendroid.testapp'
  desired_cap['appActivity'] = "io.selendroid.testapp.HomeScreenActivity"
  self.driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_cap)

 

  连接真机:PC端安装驱动,USB线连接,手机要打开开发者选项

  

# pip install requests
import requests


if __name__ == '__main__':
# 提交一个GET请求,返回一个响应对象
url = 'http://v.juhe.cn/weather/index'
url2='http://127.0.0.1/test/hello.html'
resp = requests.get(url=url)

# 状态码
print('状态码:', resp.status_code)
# 状态码说明
print('状态码:', resp.reason)

# 响应的头部
headers = resp.headers
print(type(headers))
print(headers)
for k,v in headers.items():
print('key:', k, ', value:', v)

# 文本格式的响应正文
body = resp.text
print(type(body))
print(body)
dic={}
dic=body
print(type(dic))

 

 

 

 

  

 

转载于:https://www.cnblogs.com/yunli-L/p/10644310.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值