源码分析之核心remote
selenium webdriver 的核心代码在remote下,该目录实现和定义了我们进行自动化测试几乎全部的核心API。
该目录文件结构如下
其源码路径为 selenium/webdriver/remote,remote下个py文件功能大致说明如下:
- init.py 用于标识remote是标准的python package
- command.py 一个类,里面定义了标准的webdriver命令常量
- errorhandler.py 定义了webdriver wire 协议中的错误编码
- file_detector.py 定义和实现了文件监控能力
- getAttribute.js 定义和实现了获取属性能力
- isDisplayed.js 定义和实现了判断元素是否可显示等能力
- mobile.py 定义和实现了移动端能力
- remote_connection.py 定义和实现了与webdriver远程服务连接的能力
- switch_to.py 定义和实现frame、windows互相切换的能力
- utils.py 定义和实现了辅助能力
- webdriver.py 定义和实现了webdriver核心api能力
- webelement.py 定义和实现了webdriver元素操作核心api能力