I using Java with Selenium WebDriver and I wondered is it possible to remover eg
System.setProperty("webdriver.gecko.driver", dirPath + "\\src\\test\\resources\\geckodriver.exe");
and swap this into import library to maven? I saw on mvnrepository this library
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
<version>3.5.1</version>
</dependency>
and is it possible to remove System.setProperty and add this dependency?
You can check https://github.com/bonigarcia/webdrivermanager , which will do this part for you. For example:
WebDriverManager.getInstance(ChromeDriver.class).setup();
It'll download latest chromedriver
into .m2
folder and automatically set required system property.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.