selenium - WebDriver、ChromeDriver 和 Browser 之间如何通信?什么是 WIRE 协议(protocol)?

标签 selenium selenium-webdriver

我创建了一个在 Chrome 浏览器中完美运行的 selenium 脚本。为了让它运行,我浏览了一些以前的答案并下载了“ChromeDriver.exe”文件并在代码中添加了路径,它工作正常,但我的问题是为什么我们必须下载这个 exe 以及它的作用?

我在互联网上浏览了一些文章,但我不清楚。文章说 ChromeDriver 是“有线协议(protocol)”的实现,并且 Webdriver 在执行脚本时与 ChromeDriver 对话。如果是这样,它在做什么?

一些专家可以提出一些指示以更清楚地说明这一点吗?

最佳答案

ChromeDriver 文档的“getting start”给出了明确的答案。

ChromeDriver is a separate executable that WebDriver uses to control Chrome. It is maintained by the Chromium team with help from WebDriver contributors. [...] The ChromeDriver class starts the ChromeDriver server process at creation and terminates it when quit is called. [...]



看到这个answer from the Chrome Driver users group其中包括对 chromedriver.exe 如何与 Chrome 浏览器进行通信的高级描述。

[...] ChromeDriver implements the WebDriver protocol, which is a REST-like interface [...]. WebDriver clients communicate with ChromeDriver by sending HTTP requests. ChromeDriver then communicates with the browser through the DevTools remote debugging interface, which is a WebSockets interface [...].

关于selenium - WebDriver、ChromeDriver 和 Browser 之间如何通信?什么是 WIRE 协议(protocol)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38312546/

相关文章:

java - 如何使用 Selenium WebDriver 和 Java 从下拉列表中选择一个选项?

python - 使用 Splinter + PhantomJS (Python) 访问表单

ruby - 如何在 Selenium Automation 的 CSS 选择器中排除特定的类/属性名称?

'float' 类型的 Python Selenium send_key 对象没有 len()

Java在上传到AWS云之前创建文件副本

Selenium:如何获取自动开始下载的链接?

java - 将Keys发送到您无法检查的文本框(使用Java)

在 Selenium WebDriver 中拖放的 JavaScript 解决方法

google-chrome - 使用 ChromeDriver 和 Chrome DevTools 协议(protocol)进行多客户端远程调试

c# - 对 URL 的远程 WebDriver 服务器的 HTTP 请求 - Chrome