WDA原理分析

1、什么是WDA

WebDriverAgent是Facebook 在17年的 SeleniumConf 大会上推出了一款新的iOS移动测试框架。

下面摘录一段官方对于WebDriverAgent的介绍字段:(官方文档:https://github.com/facebook/WebDriverAgent

WebDriverAgent 在 iOS 端实现了一个 WebDriver server ,借助这个 server 我们可以远程控制 iOS 设备。你可以启动、杀死应用,点击、滚动视图,或者确定页面展示是否正确。This makes it a perfect tool for application end-to-end testing or general purpose device automation.(它说它是iOS上一个完美的e2e的自动化解决方案) It works by linking XCTest.framework and calling Apple’s API to execute commands directly on a device.(链接XCTest.framework调用苹果的API直接在设备上执行命令) WebDriverAgent is developed and used at Facebook for end-to-end testing and is successfully adopted by Appium. (Appium封装工作正在进行中,如果一旦封装好,那么以后就可以直接用Appium提供的binding了。)It is currently maintained by Marek Cirkos and Mehdi Mulani。

image2018-10-12%2017%3A1%3A25.png?versio

2、简单原理图

WebDriver之所以能够实现与浏览器进行交互,是因为浏览器实现了Mobile JSON Wire Protocol Specification协议,这个协议是使用JOSN通过HTTP进行传输。

它的实现使用了经典的Server-Client架构(C/S),客户端发送一个requset,服务器端返回一个response。

image2018-10-12%2017%3A50%3A50.png?versi
在开始下面的内部实现细节的讲解前,我们下明确几个概念:

1、WDAClient

WDAClient是基于WebDriverAgent实现的WDA的客户端。facebook-wda 就是 WDA 的 Python 客户端库,通过直接构造HTTP请求直接跟WebDriverAgent通信。

2、WDAServer

运行WDA App的机器,实现了WebDriver的通讯协议

3、Session

服务器端需要维护客户端的Session,客户端首次发送请求的字符串是'/session/sessionId/urlurlurlsessionId/url′。服务器端根据url打开对应的url地址,同时将sessionId解析成真实的值。然后返回给客户端。以后客户端再向浏览器发送请求时,将会携带session值一起发送。

1
2
3
4
5
6
7
8
[debug] [BaseDriver] Creating session with W3C capabilities: { "alwaysMatch" :{"platformNa...
[BaseDriver] Session created with session  id :  7a1d8eca - 8c48 - 4a94 - 8256 - ab283e2af4c3
 
[Appium] New AndroidUiautomator2Driver session created successfully, session  7a1d8eca - 8c48 -
  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值