硒地址
您可以将 selenium 服务器或 selenium 网格 url 提供给seleniumAddress
.
您可以在测试的相同或不同机器上启动 selenium 服务器或网格
脚本驻留
1.1) 本地硒服务器
. Selenium server run on same machine where test scripts reside
. When running test, browser opened on the machine where selenium server running
. Communicate Path: ( in same machine where test script reside)
test script -> selenium server -> webdriver binary -> browser
1.2) 远程硒服务器
. Selenium server run on remote machine where test scripts **NOT** reside
. When running test, browser opened on the remote machine where selenium server running
. Communicate Path: ( cross two machines )
test script -> test script machine
-> selenium server (on remote machine)
-> webdriver binary (on remote machine)
-> browser (on remote machine)
1.3)硒网格
. Grid use Master/Slave
. Multiple Slave machines register to One Master machine
. Each Slave can install couple kinds of browsers
. Slave tell Master it can provide the kinds of browser and
max browser instances running in parallel when register to Master
. Master will determine each test open browser on which Slave
by test required browser type and not exceed the max browser instances on slave
. Communicate Path: ( cross three machines )
test script -> test script machine
-> master machine
-> selenium server (on choosen slave machine)
-> webdriver binary (on choosen slave machine)
-> browser (on choosen slave machine)
直接联系
. When directConnect: true, seleniumAddress will be ignored (if both configured)
. Only chrome and firefox support directConnect so far
. Communicate Path: ( in same machine where test script reside)
test script -> webdriver binary -> browser
使用 seleniumAddress,您可以在启动 selenium 服务器/网格的终止窗口中看到测试脚本与 webdriver 通信的日志。
从日志中,您可以获得如下信息:
- 测试脚本使用哪个定位器来查找元素
- 查找/操作元素的步骤完成或失败
- 当测试用例失败时,它无法传达哪个元素。
这些信息对于调试测试脚本非常有用
默认情况下使用 directConnect量角器不会在单独的终止窗口中启动 webdriver 二进制文件,也不会将通信日志定向到文件中。
所以它不适合调试测试脚本。