Akash Chavan
Akash Chavan

Reputation: 335

Can selenium test run without using System.setProperty in the code?

I am able to run the selenium test in our project without using System.setProperty. Not sure how it works, we have set the environment Path variable with value "C:\Akash\Drivers" where all the drivers are stored. Can anyone explain how/ this works without setting up chrome path?

public class SeleniumTest {

    public static void main(String[] args) throws MalformedURLException {
        // TODO Auto-generated method stub


        localSettings();
    }
public static void localSettings() {
        // System.setProperty("webdriver.chrome.driver", "C:\\Akash\\Drivers\\chromedriver.exe");
        WebDriver driver = new ChromeDriver();
        driver.get("https://www.google.com");

    }
}

Upvotes: 1

Views: 3842

Answers (1)

Ishita Shah
Ishita Shah

Reputation: 4035

Please Refer official explanation given Seleniumhq & Chrome,

  • How it retrieves and Work with Environment Variables :

WebDriver works with Chrome through the chromedriver binary. You need to have both chromedriver and a version of chrome browser installed. chromedriver needs to be placed somewhere on your system’s path in order for WebDriver to automatically discover it. The Chrome browser itself is discovered by chromedriver in the default installation path. These both can be overridden by environment variables.

Provided by Seleniumhq, Blog Link : Click Here

  • Chrome Driver Setup Provisions:

Provided by Chrome, Blog Link : Click Here

Upvotes: 2

Related Questions