The reason

This error is caused due to the presence of undesired system files such as thumbnails or '.DS_Store' file in the folder where webdriver binaries are located.

For example, if we are executing the tests in chrome browser on your Mac, the agent checks for the chromedriver binaries inside the "<path_to_drivers_directory>\drivers\googlechrome\<version>\" directory.

However the agent file sees the .DS_Store files before the chromedriver binaries and throws an Exception.

The fix

In order to fix this error, we need to delete the unwanted .DS_Store file present with the webdriver binaries as follows:

1. Open up the Terminal application.

2. Navigate to the directory that you wish to recursively delete the .DS_Store files from using the cd command.

In our case, we need to delete the .DS_Store files from all the sub-directories under drivers folder.

cd <path_to_drivers_directory_in_your_mac>\drivers\

3. Once you are in the drivers folder, type this command into Terminal and press Enter:

find . -name ‘*.DS_Store’ -type f -delete

That's all. We have successfully deleted the .DS_Store files under drivers directory.

Note: It is perfectly safe to delete the '.DS_Store' file in drivers directory since the file in irrelevant in this folder.