I am trying to setup a simple program in selenium and run into
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: unknown error: cannot find Chrome binary.
Please find below sample code and also the error details
@Test
public void shouldAnswerWithTrue()
{
WebDriver driver = new ChromeDriver();
driver = new ChromeDriver();
driver.manage().window().maximize();
driver.manage().deleteAllCookies();
driver.manage().timeouts().pageLoadTimeout(40, TimeUnit.SECONDS);
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.get("https://www.google.com/");
driver.findElement(By.name("q")).sendKeys("YouTube");
WebElement searchIcon = driver.findElement(By.name("btnK"));
searchIcon.click();
assertTrue( true );
}
After running the above program, I notice the error below:
Aug 02, 2023 9:56:56 PM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
WARNING: The chromedriver version (96.0.4664.45) detected in PATH at /usr/local/bin/chromedriver might not be compatible with the detected chrome version (115.0.5790.114); currently, chromedriver 115.0.5790.102 is recommended for chrome 115.*, so it is advised to delete the driver in PATH and retry
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: session not created: This version of ChromeDriver only supports Chrome version 96
Current browser version is 115.0.5790.114 with binary path /Applications/Google Chrome.app/Contents/MacOS/Google Chrome