Selenium vs Puppeteer 测试 CEF 应用程序的 UI
Selenium vs Puppeteer to test the UI of a CEF application
我正计划为我的 CEF 应用程序构建集成测试。集成测试将侧重于验证应用程序的 UI。我认为可能有两种方法可以做到:
1. Use Selenium/webdriver + chromedriver: Selenium talks to chromedriver through
webdriver protocol, and chromedriver talks to my CEF application through
Chrome Devtools Protocol
2. Use Puppeteer or similar library that talks to CEF application directly
through Chrome Devtools Protocol
首先,有没有办法让 Puppeteer 连接到远程 chrome 调试器?大多数用例似乎都在 Puppeteer 中启动无头 chrome,这不是我想要的。
如果这两个选项都可行,您更喜欢哪个选项? Puppeteer 似乎比 Selenium 具有更丰富的功能来测试实现 Chrome Devtools 协议的用户代理。 Selenium/webdriver 的跨平台优势似乎与测试 CEF 应用程序无关。
First of all, is there a way for Puppeteer to connect to a remote chrome debugger?
是的,有一个 puppeteer.connect 允许连接到已经 运行 的浏览器。
If both options are doable, which option would you prefer?
鉴于您只对 Chromium 感兴趣,我会选择 puppeteer。 Puppeteer 脚本通常不需要投入 "sleep()" 调用 - 相反,有强大的原语来等待条件,例如page.waitForSelector, page.waitFoRequest e.t.c。
我正计划为我的 CEF 应用程序构建集成测试。集成测试将侧重于验证应用程序的 UI。我认为可能有两种方法可以做到:
1. Use Selenium/webdriver + chromedriver: Selenium talks to chromedriver through
webdriver protocol, and chromedriver talks to my CEF application through
Chrome Devtools Protocol
2. Use Puppeteer or similar library that talks to CEF application directly
through Chrome Devtools Protocol
首先,有没有办法让 Puppeteer 连接到远程 chrome 调试器?大多数用例似乎都在 Puppeteer 中启动无头 chrome,这不是我想要的。
如果这两个选项都可行,您更喜欢哪个选项? Puppeteer 似乎比 Selenium 具有更丰富的功能来测试实现 Chrome Devtools 协议的用户代理。 Selenium/webdriver 的跨平台优势似乎与测试 CEF 应用程序无关。
First of all, is there a way for Puppeteer to connect to a remote chrome debugger?
是的,有一个 puppeteer.connect 允许连接到已经 运行 的浏览器。
If both options are doable, which option would you prefer?
鉴于您只对 Chromium 感兴趣,我会选择 puppeteer。 Puppeteer 脚本通常不需要投入 "sleep()" 调用 - 相反,有强大的原语来等待条件,例如page.waitForSelector, page.waitFoRequest e.t.c。