Search code examples
selenium-webdriverchrome-web-driver

How do I get matching version of chrome web driver for selenium automation testing?


I am doing selenium with java test automation coding. My chrome version is 116.0.5845.110. I couldn't find a web driver for this version of chrome . So I took Version: 116.0.5845.96 while running the. WEBDRIVER I am getting the error

“chromedriver” can’t be opened because Apple cannot check it for malicious software.The software need to be updated.Contact the developer for more information.

This is the code I am executing

System.setProperty("webdriver.chrome.driver" , "/Users/user1/Desktop/browserdriversforAutomatedtesting/chromedriver");
WebDriver driver = new ChromeDriver();

Solution

  • This is happening because of security measures in macOS.

    When the OS detects an executable file that has been downloaded on disk that does not provide any trust, it will under certain circumstances add a com.apple.quarantine extended attribute to the file. The quarantine attribute subsequently prevents execution of the file.

    To remediate this issue, open a Terminal window and navigate to location of your chromedriver. Execute the following command to remove the quarantine (you may need sudo depending on your privileges):

    xattr -d com.apple.quarantine chromedriver