Getting a mismatch with the chrome version for selenium project

226 Views Asked by At

My code was working earlier but when I used gradle command line to run the project, I got this error: enter image description here I'm using bonigarcia library so the incompatibility issue with the chrome version on my system should not arise.

Tried changing the selenium library and webdrivermanager library but then it renders the whole project unusable.

Gradle File:

    id 'java'
}

repositories {
    mavenCentral()
}

dependencies {
    implementation group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '3.141.59'
    testImplementation 'org.testng:testng:7.4.0'
    implementation group: 'io.github.bonigarcia', name: 'webdrivermanager', version: '5.4.1'
    compileOnly group: 'org.projectlombok', name: 'lombok', version: '1.18.22'
    implementation group: 'io.qameta.allure', name: 'allure-testng', version: '2.17.1'

}

test {
    useTestNG()
}
1

There are 1 best solutions below

2
On
name: 'selenium-java', version: '3.141.59'

You are using way too old selenium. Upgrade to the latest version of selenium i.e. v4.15.0.

And once you upgrade to latest selenium, you no longer need WebDriverManager library. The new built-in tool Selenium Manager will do what WebDriverManager used to do before.

Code can be as simple as:

public static void main(String[] args) {
    WebDriver driver = new ChromeDriver();
    driver.manage().window().maximize();
    driver.get("https://www.google.com/");
    driver.quit();
}

Refer below answers for more details on this topic: