How to run Selenium WebDriver test cases in Chrome in MAC OS?

27,539

Solution 1

Download the latest chrome version from

http://chromedriver.storage.googleapis.com/index.html

Path should be adjusted through build path.

Try it once, it is helping to you...

Solution 2

user5899853 Try this:

System.setProperty("webdriver.chrome.driver" ,  "/Users/sampada/Applications/chromedriver");

And:

@BeforeClass
public static void init() {
driver = new ChromeDriver(); //init chrome driver
driver.get("http://google.com”); //url of website we like to test

Solution 3

You can use brew to install chromedriver and keep it up-to-date:

brew install chromedriver
Share:
27,539
Pavan Kumar
Author by

Pavan Kumar

I am software QA Engineer from India specialized in Manual and Automation Testing using Selenium WebDriver. You can view my entire profile below. LinkedIn Profile: https://in.linkedin.com/in/pavankumar75

Updated on May 03, 2022

Comments

  • Pavan Kumar
    Pavan Kumar about 2 years

    I am getting this error:

    Exception in thread "main" java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see http://code.google.com/p/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://chromedriver.storage.googleapis.com/index.html at com.google.common.base.Preconditions.checkState(Preconditions.java:197) at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:110) at org.openqa.selenium.chrome.ChromeDriverService.access$0(ChromeDriverService.java:1) at org.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExecutable(ChromeDriverService.java:118) at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:291) at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:82) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:117) at selenium.basics.Chrome.chromeBrowser(Chrome.java:16) at selenium.basics.Firefox.main(Firefox.java:8)

  • Mads Y
    Mads Y about 5 years
    It's actually placed in a cask: brew cask install chromedriver
  • Craig Wayne
    Craig Wayne over 3 years
    Just an update to the above comment, brew now disables the above command. From brew: > Error: Calling brew cask install is disabled! Use brew install [--cask] instead.
  • Craig Wayne
    Craig Wayne over 3 years
    Just an update to the above brew now disables the above command. From brew: > Error: Calling brew cask install is disabled! Use brew install [--cask] instead.