Cài đặt Selenium Java trên IntelliJ IDEA như thế nào

Cài đặt Selenium Java trên IntelliJ IDEA như thế nào

Bạn có thể cài đặt Selenium Java trên IntelliJ IDEA bằng cách sử dụng công cụ quản lý gói Maven hoặc công cụ quản lý gói Gradle.

Cài đặt với Maven:

Tạo một dự án mới trong IntelliJ IDEA.

Mở tệp pom.xml và thêm các gói cần thiết cho Selenium và Java. Ví dụ:

<dependencies>
  <dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>3.14.0</version>
  </dependency>
  <dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.12</version>
    <scope>test</scope>
  </dependency>
</dependencies>




 
Lưu tệp pom.xml và chọn "Import Changes" từ thanh trình đơn của IntelliJ IDEA.

Chạy các bản build và kiểm tra xem gói Selenium Java có được cài đặt thành công hay không.

Cài đặt với Gradle:

Tạo một dự án mới trong IntelliJ IDEA.

Mở tệp build.gradle và thêm các gói cần thiết cho Selenium và Java. Ví dụ:

dependencies {
  testCompile group: 'junit', name: 'junit', version: '4.12'
  testCompile group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '3.14.0'
}


Lưu tệp build.gradle và chọn "Import Changes" từ thanh trình đơn của IntelliJ IDEA.

Chạy các bản build và kiểm tra xem gói Selenium Java có được cài đặt thành công hay không.

Reference:
https://automationbyte.com/how-to-setup-selenium-project-with-intellij/