selenium和appium启动的感悟

阅读源码后整理记录如下:

selenium :

  1.若为webdriver.Chrome()方式启动:①子程序打开chromedriver.exe程序,程序打开后,监听9515端口作为remote_server(如果为默认启动,remote server地址为http://127.0.0.1:4444/wd/hub)。②webdriver实例化__init__(),脚本发起请求 http://localhost:9515/session ,浏览器被打开(浏览器驱动打开的),生成sessionId,并通过响应返回给客户端(该sessionId用于后面client和remote server通信的固定通道)。③接下来客户端通过command_executor实例调用execute(command,opts)来发送请求,让浏览器驱动在指定浏览器上执行命令。

appium:

1.若为webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)方式启动:①remote server地址为http://localhost:4723/wd/hub。②其中第4点即为第一步启动的remote server。③测试脚本→remote server→bootstrap.jar→在目标设备执行命令。④webdriver实例化__init__(),脚本发起请求 http://localhost:9515/session,生成sessionId

原文地址:https://www.cnblogs.com/Delo/p/10392120.html