来自 C++ 的 Web 自动化
我们需要从 C++ 应用程序执行一些相当复杂的 Web 自动化(登录到应用程序、执行一些操作、注销),但性能非常重要,因此我们正在研究选项.
We need to do some fairly complex web automation from C++ application (log into application, do some actions, logout), but performance is really important so we are looking at options.
有没有一种方法可以直接从 C++ 驱动 WebKit 或其他 headless 引擎,而无需在其间添加更多层(例如 selenium+webdriver+网络通信+...)?可能是 Chrome 驱动程序?
Is there a way to drive WebKit or other headless engine directly from C++, without the need for few more layers in between (like selenium+webdriver+network communication+...)? Chromedriver perhaps?
如果选项 1 不可行,从 C++ 运行 WebDriver(使用真实浏览器)的最佳方式是什么?
If option 1 is not possible, what is the most optimal way to run WebDriver (with real browser) from C++?
推荐答案
你应该看看 PhantomJS(一个无头 WebKit浏览器),它带有 GhostDriver,这是 PhantomJS 的 WebDriver 协议实现.
You should look into PhantomJS (a headless WebKit browser), which comes with GhostDriver, which is the WebDriver protocol implementation for PhantomJS.
您仍然需要使用我不知道的 WebDriver 语言绑定之一C++ 中的任何语言绑定,但也许您的团队可以将其中一种可用语言用于自动化目的.
You will still need to use one of the WebDriver language bindings, which I'm not aware of any of the language bindings that are in C++, but perhaps one of the available languages could be used by your team for automation purposes.
最坏的情况是,您始终可以在 Python 中创建 WebDriver 脚本,然后从您的 C++ 应用程序中调用 Python 脚本.
Worst case, you could always create your WebDriver script in Python, and call the Python script from your C++ application.
相关文章