-1

When this(selenium-chrome-driver) dependency can be use ?

<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-chrome-driver -->
<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-chrome-driver</artifactId>
    <version>3.14.0</version>
</dependency>

On many answers I have read, It need to use with Chrome binary definition. By using only chrome binary we are able to execute script on Chrome Browser. Thus, driver calling is subject with Binary definition.

Question: So what is the use of this dependency, without chrome binary file ?

I have referred below answers and tried, without using binary declaration. Which says to use WebDriverManager dependency:

How to work with chrome driver in Maven

selenium 2 chrome driver

https://stackoverflow.com/a/39809773/9405154

https://github.com/bonigarcia/webdrivermanager


This is Resolved,

Error: Failure to transfer org.apache.commons:commons-compress:jar:1.14 from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.commons:commons-compress:jar:1.14 from/to central (https://repo.maven.apache.org/maven2): The operation was cancelled.

Ishita Shah
  • 3,955
  • 2
  • 27
  • 51

2 Answers2

1

Selenium is a multi-module project. One of the modules is selenium-chrome-driver. It contains logic related to running chrome with selenium. You can add this dependency to your project and somehow modify/extend its original behavior. It will not run the actual chrome browser without having a binary though - that's just how it works. You will have to build executable file by yourself then. You can check how projects use this dependency here

Long story short if you don't want to bother managing binaries use WebDriverManager because it works like a charm.

Based on the error text from your question, you can try the following solution:

Remove all your failed downloads:

find ~/.m2  -name "*.lastUpdated" -exec grep -q "Could not transfer" {} \; -print -exec rm {} \;

For windows:

cd %userprofile%\.m2\repository
for /r %i in (*.lastUpdated) do del %i

Then rightclick on your project in eclipse and choose Maven->"Update Project ...", make sure "Update Dependencies" is checked in the resulting dialog and click OK.

copied from here: Link

Vladimir Efimov
  • 797
  • 5
  • 13
  • Thanks, It resolved maven issue. I am looking for my actual question. – Ishita Shah Nov 02 '18 at 09:35
  • @IshitaShah did some research and updated my answer. hope this helps. – Vladimir Efimov Nov 02 '18 at 12:32
  • please share if there is some official announcement by Selenium community. I don't think so based on it, they may share this dependency if it has no us. – Ishita Shah Nov 02 '18 at 12:37
  • Selenium is a multi-module project. Each module has it's own responsibilities. This particular is responsible for integration with chrome (not for running the browser itself - it is done by the binary supported by chromium community). You can see that selenium has 42 sub-projects each of them could be attached to a project separately and used for providing an enhancement behavior. So it's not an issue that they provide it, it's just that you expected it to actually launch the browser but it is just let's say a backend logic, not the actual browser starter. – Vladimir Efimov Nov 02 '18 at 12:51
0

I assume your automation project is a maven-project. So when you build your project, the dependencies in pom will be downloaded locally to execute. But a binary file needs to be set using SystemProperty and passing the parameter as the path to that webdriver, which will allow the webdriver instance to communicate with the browser instance on that machine. So, we do not need this dependency in all. Same goes for other browser too I guess.

Also if you are doing CI using jenkins, you should prefer using docker. That way you don't have to manage the binary instances, the docker will handle that for you.

Sagar Jani
  • 161
  • 2
  • 3
  • 21