[英]difference between chromedriver.exe and selenium-chrome-driver.jar
I want to know the difference between selenium-chrome-driver.jar
and chromedriver.exe
我想知道selenium-chrome-driver.jar
和chromedriver.exe
之间的区别
My friend is able to get the chrome browser launched without specifying the location of chromedriver.exe
in his script/chromedriver initialization, and she has mentioned selenium-chrome-driver.jar
in pom.xml
, does this make any difference. 我的朋友能够启动chrome浏览器,而无需在脚本/ chromedriver初始化中指定chromedriver.exe
的位置,并且她在pom.xml
提到了selenium-chrome-driver.jar
,这有什么区别。 If so then how? 如果是这样,那又如何?
So selenium-chrome-driver.jar
is more or less just a ZIP file that can consist of anything. 因此, selenium-chrome-driver.jar
或多或少是一个可以包含任何内容的ZIP文件。
It would be best to reference the location of the chromedriver.exe
to launch Chrome. 最好参考chromedriver.exe
的位置来启动Chrome。
I believe there isn't much of a difference though if you wanted to use the .jar
, you would need to extract selenium-chrome-driver.jar
and reference the chromedriver.exe
from within there. 我相信,如果您要使用.jar
,则没有太大区别,您需要提取selenium-chrome-driver.jar
并从其中引用chromedriver.exe
。
First of all you need to understand how Selenium communicates with the browser. 首先,您需要了解Selenium如何与浏览器通信。
When you write selenium tests, you write code in the language of your choice using the client code bindings. 在编写硒测试时,您将使用客户端代码绑定以您选择的语言编写代码。 This code then talks to the relevant driver binary that is run inside the browser as a plugin using the JSON wire protocol. 然后,此代码使用JSON Wire协议与作为插件的浏览器内部运行的相关驱动程序二进制文件进行对话。
So the interaction is: 因此,交互是:
Selenium has a client API which details all of the commands you can send over the JSON wire protocol, it then has a series of pieces of code that allow it to interact with specific driver binaries. Selenium有一个客户端API,其中详细说明了您可以通过JSON Wire协议发送的所有命令,然后它具有一系列代码,使其可以与特定的驱动程序二进制文件进行交互。 So in your case the selenium-chrome-driver.jar
has the code that is specifically used to interact with the chrome driver binary. 因此,在您的情况下, selenium-chrome-driver.jar
具有专门用于与chrome驱动程序二进制文件进行交互的代码。 If you were talking to the gecko driver binary, you would need to use selenium-firefox-driver.jar
. 如果您正在与gecko驱动程序二进制文件对话,则需要使用selenium-firefox-driver.jar
。 Each driver binary that targets a specific browser has an associated jar that contains the code required to talk to the relevant driver binary. 每个针对特定浏览器的驱动程序二进制文件都有一个关联的jar,其中包含与相关驱动程序二进制文件通信所需的代码。
For this to work you need all elements, so to be able to drive Google Chrome with Webdriver you will need to have the selenium-chrome-driver.jar
and the chromedriver.exe
binary. 为此,您需要所有元素,因此要能够使用Webdriver驱动Google Chrome,您需要具有selenium-chrome-driver.jar
和chromedriver.exe
二进制文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.