简体   繁体   English

chromedriver.exe和selenium-chrome-driver.jar之间的区别

[英]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.jarchromedriver.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.jarchromedriver.exe二进制文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 硒chromedriver.exe - Selenium chromedriver.exe 硒找不到chromedriver.exe - selenium is not locating chromedriver.exe 如何在没有 ChromeDriver.exe 的情况下从 Selenium 远程 Web 驱动程序启动 GoogleChrome - How to Launch GoogleChrome from Selenium Remote Web Driver without ChromeDriver.exe 如何在 selenium 中不设置本地驱动程序的情况下启动浏览器? (不访问本地chromeDriver.exe) - How to launch browser without setting local driver in selenium? (Without accessing local chromeDriver.exe) 码头工人 驱动程序可执行文件不存在:/chromedriver.exe - Docker. The driver executable does not exist: /chromedriver.exe Selenium Java:当程序退出时保证chromedriver.exe关闭 - Selenium Java: Guarantee chromedriver.exe shutdown when program exits Selenium WebDriver 3.0.1 chromedriver.exe 2.25 --whitelisted-ips="" - Selenium WebDriver 3.0.1 chromedriver.exe 2.25 --whitelisted-ips=“” Java Selenium Chromedriver.exe 不存在 IllegalStateException - Java Selenium Chromedriver.exe Does not Exist IllegalStateException 使用远程“ chromedriver.exe”文件设置Chrome WebDriver - Setup Chrome WebDriver with remote 'chromedriver.exe' file 使用使用相对路径存储在 jar 中的资产文件中的 ChromeDriver.exe - Using a ChromeDriver.exe that was stored in an asset file in a jar using relative pathing
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM