Exception in thread “main” java.lang.AbstractMethodError: Receiver class org.openqa.selenium.chrome.ChromeDriverService$Builder does not define

I am encountering an error when I run my class file.

Here is the error message:

Task :compileJava UP-TO-DATE
Task :processResources UP-TO-DATE
Task :classes UP-TO-DATE
Task :CrawlingTest.main() FAILED
3 actionable tasks: 1 executed, 2 up-to-date
Exception in thread “main” java.lang.AbstractMethodError: Receiver class org.openqa.selenium.chrome.ChromeDriverService$Builder does not define or inherit an implementation of the resolved method ‘abstract java.io.File findDefaultExecutable()’ of abstract class org.openqa.selenium.remote.service.DriverService$Builder.
at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:437)
at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:138)
at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:72)
at Nawa3.Nawa3.service.CrawlingTest.getChromeDriver(CrawlingTest.java:40)
at Nawa3.Nawa3.service.CrawlingTest.main(CrawlingTest.java:47)
FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:CrawlingTest.main()’.

Process ‘command ‘C:/Users/ASUS/.jdks/openjdk-17.0.2/bin/java.exe” finished with non-zero exit value 1

  • Try:

Run with –stacktrace option to get the stack trace.
Run with –info or –debug option to get more log output.
Run with –scan to get full insights.

  • Get more help at https://help.gradle.org
    BUILD FAILED in 1s

I’ve seen an article about the dependency issue and tried the suggested fixes, but the problem persists.

Class File
Here is the class file I am using:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>package Nawa3.Nawa3.service;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
public class CrawlingTest {
private static WebDriver driver;
public static String WEB_DRIVER_ID = "webdriver.chrome.driver";
private static String WEB_DRIVER_PATH = "C:\Users\ASUS\Downloads\chromedriver-win64\chromedriver-win64\chromedriver.exe";
public static WebDriver getChromeDriver() {
if (System.getProperty("webdriver.chrome.driver") == null) {
System.setProperty("webdriver.chrome.driver", WEB_DRIVER_PATH);
}
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--remote-allow-origins=*");
chromeOptions.addArguments("--disable-web-security");
chromeOptions.addArguments("--disable-gpu");
chromeOptions.addArguments("--no-sandbox");
chromeOptions.addArguments("--disable-dev-shm-usage");
chromeOptions.addArguments("--disable-blink-features=AutomationControlled");
chromeOptions.addArguments("user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36");
chromeOptions.addArguments("Accept-Language=ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7");
chromeOptions.addArguments("Accept=text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7");
WebDriver driver = new ChromeDriver(chromeOptions);
driver.manage().timeouts().pageLoadTimeout(Duration.ofSeconds(30));
return driver;
}
public static void main(String[] args) {
WebDriver driver = getChromeDriver();
String url = "https://map.naver.com/p/search/%ED%99%8D%EB%8C%80%EC%9E%85%EA%B5%AC%EC%97%AD%EB%A7%9B%EC%A7%91?c=16.24,0,0,0,dh";
List<WebElement> webElementList = new ArrayList<>();
String query = "span.place_bluelink.TYaxT";
String iframeId = "searchIframe";
try {
driver.get(url);
Thread.sleep(5000);
driver.switchTo().frame(driver.findElement(By.id(iframeId)));
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
webElementList = driver.findElements(By.cssSelector(query));
for (WebElement element : webElementList) {
System.out.println(element.getText());
}
driver.switchTo().defaultContent();
System.out.println("Page title is: " + driver.getTitle());
System.out.println("Current URL: " + driver.getCurrentUrl());
} catch (Exception e) {
System.out.println("An error occurred: " + e.getMessage());
} finally {
driver.quit();
}
}
}
</code>
<code>package Nawa3.Nawa3.service; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeOptions; import java.time.Duration; import java.util.ArrayList; import java.util.List; public class CrawlingTest { private static WebDriver driver; public static String WEB_DRIVER_ID = "webdriver.chrome.driver"; private static String WEB_DRIVER_PATH = "C:\Users\ASUS\Downloads\chromedriver-win64\chromedriver-win64\chromedriver.exe"; public static WebDriver getChromeDriver() { if (System.getProperty("webdriver.chrome.driver") == null) { System.setProperty("webdriver.chrome.driver", WEB_DRIVER_PATH); } ChromeOptions chromeOptions = new ChromeOptions(); chromeOptions.addArguments("--remote-allow-origins=*"); chromeOptions.addArguments("--disable-web-security"); chromeOptions.addArguments("--disable-gpu"); chromeOptions.addArguments("--no-sandbox"); chromeOptions.addArguments("--disable-dev-shm-usage"); chromeOptions.addArguments("--disable-blink-features=AutomationControlled"); chromeOptions.addArguments("user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36"); chromeOptions.addArguments("Accept-Language=ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7"); chromeOptions.addArguments("Accept=text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"); WebDriver driver = new ChromeDriver(chromeOptions); driver.manage().timeouts().pageLoadTimeout(Duration.ofSeconds(30)); return driver; } public static void main(String[] args) { WebDriver driver = getChromeDriver(); String url = "https://map.naver.com/p/search/%ED%99%8D%EB%8C%80%EC%9E%85%EA%B5%AC%EC%97%AD%EB%A7%9B%EC%A7%91?c=16.24,0,0,0,dh"; List<WebElement> webElementList = new ArrayList<>(); String query = "span.place_bluelink.TYaxT"; String iframeId = "searchIframe"; try { driver.get(url); Thread.sleep(5000); driver.switchTo().frame(driver.findElement(By.id(iframeId))); driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10)); webElementList = driver.findElements(By.cssSelector(query)); for (WebElement element : webElementList) { System.out.println(element.getText()); } driver.switchTo().defaultContent(); System.out.println("Page title is: " + driver.getTitle()); System.out.println("Current URL: " + driver.getCurrentUrl()); } catch (Exception e) { System.out.println("An error occurred: " + e.getMessage()); } finally { driver.quit(); } } } </code>
package Nawa3.Nawa3.service;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

import java.time.Duration;
import java.util.ArrayList;
import java.util.List;

public class CrawlingTest {

    private static WebDriver driver; 
    public static String WEB_DRIVER_ID = "webdriver.chrome.driver";
    private static String WEB_DRIVER_PATH = "C:\Users\ASUS\Downloads\chromedriver-win64\chromedriver-win64\chromedriver.exe"; 

    public static WebDriver getChromeDriver() {
        if (System.getProperty("webdriver.chrome.driver") == null) {
            System.setProperty("webdriver.chrome.driver", WEB_DRIVER_PATH);
        }

        ChromeOptions chromeOptions = new ChromeOptions();
        chromeOptions.addArguments("--remote-allow-origins=*"); 
        chromeOptions.addArguments("--disable-web-security"); 
        chromeOptions.addArguments("--disable-gpu"); 
        chromeOptions.addArguments("--no-sandbox"); 
        chromeOptions.addArguments("--disable-dev-shm-usage"); 
        chromeOptions.addArguments("--disable-blink-features=AutomationControlled");
        chromeOptions.addArguments("user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36");
        chromeOptions.addArguments("Accept-Language=ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7"); 
        chromeOptions.addArguments("Accept=text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"); 

        WebDriver driver = new ChromeDriver(chromeOptions);
        driver.manage().timeouts().pageLoadTimeout(Duration.ofSeconds(30)); 
        return driver;
    }

    public static void main(String[] args) {
        WebDriver driver = getChromeDriver();

        String url = "https://map.naver.com/p/search/%ED%99%8D%EB%8C%80%EC%9E%85%EA%B5%AC%EC%97%AD%EB%A7%9B%EC%A7%91?c=16.24,0,0,0,dh"; 
        List<WebElement> webElementList = new ArrayList<>(); 
        String query = "span.place_bluelink.TYaxT"; 
        String iframeId = "searchIframe"; 

        try {
            driver.get(url);
            Thread.sleep(5000);
            driver.switchTo().frame(driver.findElement(By.id(iframeId)));
            driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
            webElementList = driver.findElements(By.cssSelector(query));

            for (WebElement element : webElementList) {
                System.out.println(element.getText());
            }

            driver.switchTo().defaultContent();

            System.out.println("Page title is: " + driver.getTitle());
            System.out.println("Current URL: " + driver.getCurrentUrl());

        } catch (Exception e) {
            System.out.println("An error occurred: " + e.getMessage());
        } finally {
            driver.quit();
        }
    }
}

build.gradle
This is my build.gradle file:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>plugins {
id 'java'
id 'org.springframework.boot' version '3.0.2'
id 'io.spring.dependency-management' version '1.1.0'
}
group = 'Nawa3'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
// Selenium dependency
implementation 'org.seleniumhq.selenium:selenium-java:4.21.0'
implementation 'org.seleniumhq.selenium:selenium-chrome-driver:4.21.0'
// MariaDB dependency
implementation 'org.mariadb.jdbc:mariadb-java-client:3.0.10'
implementation('org.modelmapper:modelmapper:2.4.2')
developmentOnly("org.springframework.boot:spring-boot-devtools")
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-web'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.mysql:mysql-connector-j'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
implementation group: 'org.jsoup', name: 'jsoup', version: '1.15.3'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
// JPA dependency
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
testImplementation 'org.mockito:mockito-core:3.6.0'
testImplementation 'org.mockito:mockito-junit-jupiter:3.6.0'
}
tasks.named('test') {
useJUnitPlatform()
}
</code>
<code>plugins { id 'java' id 'org.springframework.boot' version '3.0.2' id 'io.spring.dependency-management' version '1.1.0' } group = 'Nawa3' version = '0.0.1-SNAPSHOT' sourceCompatibility = '17' configurations { compileOnly { extendsFrom annotationProcessor } } repositories { mavenCentral() } dependencies { // Selenium dependency implementation 'org.seleniumhq.selenium:selenium-java:4.21.0' implementation 'org.seleniumhq.selenium:selenium-chrome-driver:4.21.0' // MariaDB dependency implementation 'org.mariadb.jdbc:mariadb-java-client:3.0.10' implementation('org.modelmapper:modelmapper:2.4.2') developmentOnly("org.springframework.boot:spring-boot-devtools") implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' implementation 'org.springframework.boot:spring-boot-starter-web' compileOnly 'org.projectlombok:lombok' runtimeOnly 'com.mysql:mysql-connector-j' annotationProcessor 'org.projectlombok:lombok' testImplementation 'org.springframework.boot:spring-boot-starter-test' implementation group: 'org.jsoup', name: 'jsoup', version: '1.15.3' implementation 'org.springframework.boot:spring-boot-starter-data-jpa' // JPA dependency testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0' testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.7.0' testImplementation 'org.mockito:mockito-core:3.6.0' testImplementation 'org.mockito:mockito-junit-jupiter:3.6.0' } tasks.named('test') { useJUnitPlatform() } </code>
plugins {
    id 'java'
    id 'org.springframework.boot' version '3.0.2'
    id 'io.spring.dependency-management' version '1.1.0'
}

group = 'Nawa3'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'

configurations {
    compileOnly {
        extendsFrom annotationProcessor
    }
}

repositories {
    mavenCentral()
}

dependencies {
    // Selenium dependency
    implementation 'org.seleniumhq.selenium:selenium-java:4.21.0'
    implementation 'org.seleniumhq.selenium:selenium-chrome-driver:4.21.0'
    
    // MariaDB dependency
    implementation 'org.mariadb.jdbc:mariadb-java-client:3.0.10'
    implementation('org.modelmapper:modelmapper:2.4.2')
    developmentOnly("org.springframework.boot:spring-boot-devtools")
    implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    compileOnly 'org.projectlombok:lombok'
    runtimeOnly 'com.mysql:mysql-connector-j'
    annotationProcessor 'org.projectlombok:lombok'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    implementation group: 'org.jsoup', name: 'jsoup', version: '1.15.3'
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    // JPA dependency
    
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
    testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
    testImplementation 'org.mockito:mockito-core:3.6.0'
    testImplementation 'org.mockito:mockito-junit-jupiter:3.6.0'
}

tasks.named('test') {
    useJUnitPlatform()
}

Environment Details

Operating System: Windows 11 (64-bit)

Java Version: OpenJDK 17.0.2

Chrome Version: 125.0.6422.113 (Official Build) (64-bit)

ChromeDriver: Version 125.0.6422.78 (downloaded from this link)

Selenium Version: 4.21.0

Issue Description

I am trying to execute a simple Selenium WebDriver script using ChromeDriver, but I encounter the following error:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>Exception in thread "main" java.lang.AbstractMethodError: Receiver class org.openqa.selenium.chrome.ChromeDriverService$Builder does not define or inherit an implementation of the resolved method 'abstract java.io.File findDefaultExecutable()' of abstract class org.openqa.selenium.remote.service.DriverService$Builder.
at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:437)
at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:138)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:72)
at Nawa3.Nawa3.service.CrawlingTest.getChromeDriver(CrawlingTest.java:40)
at Nawa3.Nawa3.service.CrawlingTest.main(CrawlingTest.java:47)
</code>
<code>Exception in thread "main" java.lang.AbstractMethodError: Receiver class org.openqa.selenium.chrome.ChromeDriverService$Builder does not define or inherit an implementation of the resolved method 'abstract java.io.File findDefaultExecutable()' of abstract class org.openqa.selenium.remote.service.DriverService$Builder. at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:437) at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:138) at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:72) at Nawa3.Nawa3.service.CrawlingTest.getChromeDriver(CrawlingTest.java:40) at Nawa3.Nawa3.service.CrawlingTest.main(CrawlingTest.java:47) </code>
Exception in thread "main" java.lang.AbstractMethodError: Receiver class org.openqa.selenium.chrome.ChromeDriverService$Builder does not define or inherit an implementation of the resolved method 'abstract java.io.File findDefaultExecutable()' of abstract class org.openqa.selenium.remote.service.DriverService$Builder.
    at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:437)
    at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:138)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:72)
    at Nawa3.Nawa3.service.CrawlingTest.getChromeDriver(CrawlingTest.java:40)
    at Nawa3.Nawa3.service.CrawlingTest.main(CrawlingTest.java:47)

What I Have Tried

Ensured that the ChromeDriver path is correctly specified.

Verified the compatibility of ChromeDriver and Chrome browser versions.

Cleaned and rebuilt the project.

Invalidated caches and restarted the IDE.

Despite these steps, the issue persists. Any help or guidance to resolve this would be greatly appreciated.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật