Manage driver executables using webdrivermanager

In order to run our selenium webdriver automation scripts on chrome/firefox browsers, we have to download the binary/.exe files like Chromedriver.exe and geckodriver.exe.

And also we need to set the path of these files in our script like below or its location should be added to the classpath. Earlier we have seen examples to launch browsers like Chrome, Firefox and Edge browser

For chrome browser :-

System.setProperty("webdriver.chrome.driver", "/absolute/path/to/binary/chromedriver");

For firefox browser :-

System.setProperty("webdriver.gecko.driver", "/absolute/path/to/binary/geckodriver");

If the path is not defined or if we provide the wrong path, you will see an exception like below :-

Error: The path to the driver executable must be set by the webdriver.chrome.driver system property

Manually downloading and managing these drivers for each operating systems is very painful. We also have to check when new versions of the binaries are released / new browsers versions are released. We should check the compatibility for all the executables and add it.

Have you ever thought of downloading all the driver executables automatically ???

Yes. WebDriverManager by Boni Garcia does this. Webdrivermanager helps to download binanries/executables in an automated way. It supports browsers such as Chrome, Firefox, Opera, PhantomJS, Microsoft Edge, or Internet Explorer.

We just need to add its dependency through Maven or Gradle to download all the necessary drivers. It will download ONLY if they are not present on the WebDriverManager cache (~/.m2/repository/webdriver by default).

In Maven project, we need to add the following dependency in pom.xml :-

<dependency>
    <groupId>io.github.bonigarcia</groupId>
    <artifactId>webdrivermanager</artifactId>
    <version>3.0.0</version>
    <scope>test</scope>
</dependency>

For Gradle project:

dependencies {
    testCompile("io.github.bonigarcia:webdrivermanager:3.0.0")
}

How to use Webdrivermanager to launch chrome/Firefox browser in Selenium WebDriver ?

let us look at below example to launch chrome browser :-

package com.tests;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import io.github.bonigarcia.wdm.WebDriverManager;

public class ExampleTest {

	private WebDriver driver;
	
	@BeforeClass
	public void setUp() {
		WebDriverManager.chromedriver().setup();
		driver = new ChromeDriver();
	}
	
	@Test
	public void Seleniumtest1() {
		System.out.println("In test 1");
		driver.get("http://google.com");
		String expectedPageTitle = "Google";
		Assert.assertTrue(driver.getTitle().contains(expectedPageTitle), "Test Failed");
	}
	
	@Test
	public void Seleniumtest2() {
		System.out.println("In test 2");
	}
	
	@Test
	public void Seleniumtest3() {
		System.out.println("In test 3");
	}

	@AfterClass
	public void tearDown() {
		if(driver!=null)
			driver.quit();
	}
}

When we use webdrivermanager, By default, it tries to download the latest version of a given driver binary. if you want to use a specific version of driver, we can do that by using WebDriverManager.chromedriver().version("2.40").setup();

You can force WebDriverManager to download specific versions by changing the value of the variables in webdrivermanager.properties for wdm.chromeDriverVersion, wdm.operaDriverVersion, wdm.internetExplorerDriverVersion, or wdm.edgeDriverVersion to a concrete version.

For instance:

-Dwdm.chromeDriverVersion=2.32
-Dwdm.geckoDriverVersion=0.21.0
-Dwdm.internetExplorerVersion=3.6

If you require any further information, feel free to add your comment.

Thank You.

Selenium Tutorials: 

Comments

Have you tried on Linux? Will it work?
I did but it was not working.

what is the error message your are seeing ?

Was able to get the same example work on Mac.

Hi,

I am currently using Key word driven framework in which we did not added TestNG framework.

We are reading the data from the excel and we have excels for all the test scenarios and we have Driver script to start the execution and Keywords.java class for all the key words.

And we have one main suite where we mentioned all the excel sheet names.

How can I implement parallel execution in Keyword driven framework.

Tonight it's it can't rig out much worse
<a href=https://cialisgetdki.com>cialis buy</a>
Versus no one should ever feel like
I'm two quarters and a sympathy down
<a href="https://cialisgetdki.com">buy cialis usa</a>
And I don't deficiency to draw a blank how your verbalize sounds
These words are all I secure so I list them
I need them good to go off at near
Sashay, tea dance
We're falling separate to halftime
Sashay, tea dance
And these are the lives you fondness to assume command of
Sashay, this is the way they'd dear one
If they knew how anxiety loved me

Специализированная компания находится в Жуковский и готова предоставить многосторонние правозащитные и налоговые консультации разным международным и российским клиентам. Нашими клиентами являются большие и средние, государственные и частные фирмы, которые представляют разные отрасли. <a href=https://nur63.ru>квалифицированная юридическая помощь</a> это одиннадцатилетний полученный опыт компании дает возможность предоставлять спец и трудные адвокатские консультации частным клиентам. Услуги компании включают в свои возможности консультации.

http://waifuzhu.com/home.php?mod=space&uid=2578165&do=profile&from=space

Tax dollars are made to support the truly disabled.

If there is too much cholesterol, it can build up in the arteries and increase the risk of a stroke or heart disease.

http://marvelunited.com/HawaiianNights/index.php?action=profile;u=335267

Although this is a potassium sparing diuretic, if electrolyte imbalances become severe and a dehydrated state is maintained for too long, some may experience muscle cramps.

http://bonesmart.org/exit/out.php?url=http://beauhorn.com/forums/users/c...

Not to dwell on that, Pamela : because it's clear that you concentrate on it mainly to deal with it plus work to live with it in the many positive of ways.

fktrpr94f
You will suffer from intense drawback discomforts throughout the first few days, require would have only a short duration.

http://santecheznous.com/redirect.asp?action_id=103&url=http://beauhorn....

They are also not resistant to use products that provide instant but temporary relief such as ointments sprays and creams for back pain relief.

https://ife.co.za/groups/secure-software-for-the-internet-of-things-1335...

Check with your doctor as soon as possible if you have any problems while taking Celebrex, even if you do not think the problems are connected with the medicine or are not listed here.

Hello, just came across your website, really like your works!
Would like to share some useful links, hope you like it.
<a href=https://flvto.ch/>Youtube Converter</a>
<a href=https://y2mate.ch/>y2mate</a>
<a href=https://keepvid.ch/en/youtube-video-downloader>Youtube video downloader</a>
<a href=https://ytmp3.ch/>Youtube to mp3 converter</a>
<a href=https://listentoyoutube.ch/ja/youtube-to-mp3-sites>YouTube MP3 変換</a>
<a href=https://youtufab.com/download-youtube-mp4-1080p>Youtube to mp4</a>

Hello, just came across your website, really like your works!
Would like to share some useful links, hope you like it.
<a href=https://flvto.ch/>Youtube Converter</a>
<a href=https://y2mate.ch/>y2mate</a>
<a href=https://keepvid.ch/en/youtube-video-downloader>Youtube video downloader</a>
<a href=https://ytmp3.ch/>Youtube to mp3 converter</a>
<a href=https://listentoyoutube.ch/ja/youtube-to-mp3-sites>YouTube MP3 変換</a>
<a href=https://youtufab.com/download-youtube-mp4-1080p>Youtube to mp4</a>

Eskadron is among the very appreciated high-street manufacturers in the world that focuses on the production of supreme quality design clothing and equipment. This Italian concern has been set by Pikeur trying to fit with the jockeys' demands, have been searching for professional but also trendy equestrian accessories. So, what makes Eskadron therefore special and why their selections are therefore popular with riders?Eskadron -- why do riders from all over the world love this brand?
Eskadron has been extremely popular among horseriding lovers for a dozen or more years now. This new products are characterized by their own highquality attention to detail. Eskadron is also appreciated for their exceptional viability, elegance, innovativeness in their endeavors, contemporary structure, and accessibility. The brand's offer includes both professional items and ones for recreational riders. So, you can discover basic equestrian clothing, expert equestrian, and assorted accessories necessary for the proper saddling of a horse. Eskadron offers saddle fabrics, halters, rugs, bell boots for horses, vases, fly vases, drapes, but in addition hoodies, t shirts, breeches, even reveal jackets. All products come from the eu, which additionally verifies their quality.Eskadron's collections
Eskadron has lots of collections. Some are seasonal, others are constantly accessible their offer. The very popular collections of this brand are:
Vintage Sports - launched twice per year, this lineup consists only of horse equipment. Products from this collection are extremely straightforward, in standard soft colours but at the identical time quite tasteful.
Platinum Card - launches once annually for people who like conventional solutions. You will mostly find black and gray colors combined with delicate image motifs.
Young Star - lineup for kids that begin their experience with horseriding. It's basic horseriding accessories in bright colors and exceptional designs.
Equestrian Fanatics - clothing line made for riders who like to stick out. Available jackets, hoodies, and backpacks successfully unite casual clothing with equestrianism.
Vintage offer - Their steady offer of clothing, equipment, and accessories. You can find products useful for training and regular rides but additionally elegant reveal clothing.

Eskadron is a brand used by riders from all around the globe. For the comfort of safety and riding both yours and your horse, it is worth buying supreme quality articles, which would enable you to fully enjoy this exceptional sport.

Eskadron is among the very appreciated high-street manufacturers in the world that focuses on the production of supreme quality design clothing and equipment. This Italian concern has been set by Pikeur trying to fit with the jockeys' demands, have been searching for professional but also trendy equestrian accessories. So, what makes Eskadron therefore special and why their selections are therefore popular with riders?Eskadron -- why do riders from all over the world love this brand?
Eskadron has been extremely popular among horseriding lovers for a dozen or more years now. This new products are characterized by their own highquality attention to detail. Eskadron is also appreciated for their exceptional viability, elegance, innovativeness in their endeavors, contemporary structure, and accessibility. The brand's offer includes both professional items and ones for recreational riders. So, you can discover basic equestrian clothing, expert equestrian, and assorted accessories necessary for the proper saddling of a horse. Eskadron offers saddle fabrics, halters, rugs, bell boots for horses, vases, fly vases, drapes, but in addition hoodies, t shirts, breeches, even reveal jackets. All products come from the eu, which additionally verifies their quality.Eskadron's collections
Eskadron has lots of collections. Some are seasonal, others are constantly accessible their offer. The very popular collections of this brand are:
Vintage Sports - launched twice per year, this lineup consists only of horse equipment. Products from this collection are extremely straightforward, in standard soft colours but at the identical time quite tasteful.
Platinum Card - launches once annually for people who like conventional solutions. You will mostly find black and gray colors combined with delicate image motifs.
Young Star - lineup for kids that begin their experience with horseriding. It's basic horseriding accessories in bright colors and exceptional designs.
Equestrian Fanatics - clothing line made for riders who like to stick out. Available jackets, hoodies, and backpacks successfully unite casual clothing with equestrianism.
Vintage offer - Their steady offer of clothing, equipment, and accessories. You can find products useful for training and regular rides but additionally elegant reveal clothing.

Eskadron is a brand used by riders from all around the globe. For the comfort of safety and riding both yours and your horse, it is worth buying supreme quality articles, which would enable you to fully enjoy this exceptional sport.

Add new comment

CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.