Jak zainstalować Selenium Sterownik sieciowy

⚡ Inteligentne podsumowanie

Instalacja Selenium WebDriver requires four sequential steps: setting up Java JDK, installing Eclipse IDE, downloading the Selenium Sterownik sieciowy Java client, and configuring Eclipse with WebDriver libraries before writing your first test.

  • 🎯 Java Pierwszy: Pobierz i zainstaluj najnowszą Oracle JDK before anything else — it is the foundation for all Selenium Java projektów.
  • 🧩 Eclipse SDI: Zainstalować Eclipse IDE dla Java Developers and set the workspace path to C:\eclipse for a clean, predictable setup.
  • ⚙️ WebDriver Download: Weź Selenium Sterownik sieciowy Java client ZIP from selenium.dev and extract it to C:\selenium-4.x\ to keep JAR files accessible.
  • 📊 Build Path Config: Add all JAR files from the Selenium ZIP (including those inside the libs folder) to your Eclipse projektowanie Java Buduj ścieżkę.
  • Driver Servers: Every browser except HTMLUnit requires a separate driver server (ChromeDriver, GeckoDriver, etc.) before WebDriver can control it.

Image

Selenium Instalacja WebDrivera

Selenium instalacja składa się z 4 etapów:

Krok 1: Zainstalować Java SDK
Krok 2: Zainstalować Eclipse
Krok 3: Zainstalować Selenium WebDriver Files
Krok 4: Konfigurowanie Eclipse IDE z WebDriverem

W tym samouczku dowiemy się, jak zainstalować Selenium WebDriver. Below is the detailed process.

UWAGA: wersje Java, Eclipse, Selenium will keep updating with time. But the installation steps will remain the same. Please select the latest version and continue the installation steps below.

Krok 1 – Zainstaluj Java Zestaw programistyczny (JDK)

Pobierz i zainstaluj Java Zestaw programistyczny (JDK) w tym miejscu.

Java instalacja sprzętu

Ta wersja JDK jest dostarczana w zestawie Java Runtime Environment (JRE), więc nie trzeba pobierać i instalować środowiska JRE osobno.

Uwaga: Download the latest available version of the JDK when accessing the download page. The specific version is not critical. As of the writing of this tutorial, the current version is 24.

Once installation is complete, open a command prompt and type java. If you see the following screen, you are good to move to the next step.

Zainstalować Java Zestaw programistyczny (JDK)

Krok 2 – Zainstaluj Eclipse IDE

Pobierz najnowszą wersję "Eclipse IDE dla Java Deweloperzy” w tym miejscu. Be sure to choose correctly between the Windows Wersje 32-bitowe i 64-bitowe.

Zainstalować Eclipse IDE

You should be able to download an exe file named eclipse-inst-win64 do konfiguracji.

Zainstalować Eclipse IDE

Double-click the file to start the Eclipse installer. A new window will open. Click Eclipse IDE dla Java Programiści.

Zainstalować Eclipse IDE

A new window will open. Click the path button (marked 1) and change the install path to C:\eclipse. Następnie kliknij przycisk Zainstalować button (marked 2).

Zainstalować Eclipse IDE

After successful installation, a window will appear. Click Premiera.

Zainstalować Eclipse IDE

To rozpocznie Eclipse IDE for you.

Krok 3 - Selenium Instalacja WebDrivera

Pobierz Selenium Sterownik sieciowy Java Kierowca klienta w tym miejscu. You will find client drivers for other languages on that page, but select only the one for Java.

Pobierz pliki Jar

This download comes as a ZIP file named selenium-4.30.0. For simplicity, extract the contents of this ZIP file to your C drive so that you have the directory C:\selenium-4.30.0\. This directory contains all the JAR files that you will later import into Eclipse.

Krok 4 - Konfiguruj Eclipse IDE z WebDriverem

  1. Uruchom eclipse.exe plik wewnątrz eclipse folder. If you followed step 2 correctly, the executable is at C:\eclipse\eclipse.exe.
  2. Gdy zostaniesz poproszony o wybranie obszaru roboczego, zaakceptuj domyślną lokalizację.

Konfigurowanie Eclipse IDE z WebDriverem

3. Create a new project through Plik > Nowy > Java Projekt. Name the project newproject.

Konfigurowanie Eclipse IDE z WebDriverem

A new pop-up window will open. Enter the following details:

  1. Nazwa projektu
  2. Location to save the project
  3. Wybierz środowisko wykonawcze JRE
  4. Wybierz opcję projektu układu
  5. Kliknij Zakończyć

Konfigurowanie Eclipse IDE z WebDriverem

4. In this step:

  1. Right-click on the newly created project.
  2. Wybierz New > Package and name the package newpackage.

Konfigurowanie Eclipse IDE z WebDriverem

A pop-up window will open. Enter the package name and click Zakończyć.

Konfigurowanie Eclipse IDE z WebDriverem

5. Utwórz nowy Java class under newpackage by right-clicking it and selecting New > Class. Nazwij to MyClass. Twój Eclipse IDE powinno wyglądać jak na obrazku poniżej.

Konfigurowanie Eclipse IDE z WebDriverem

Po kliknięciu Klasa, a pop-up window will open. Enter the class name and click Zakończyć.

Konfigurowanie Eclipse IDE z WebDriverem

This is how the workspace looks after creating the class.

Konfigurowanie Eclipse IDE z WebDriverem

Now you need to add the Selenium WebDriver libraries to the Java Build Path. In this step:

  1. Kliknij prawym przyciskiem myszy newproject na której: Właściwości.
  2. In the Properties dialog, click Java Ścieżka budowania.
  3. Kliknij ikonę biblioteki patka.
  4. Kliknij Dodaj zewnętrzne pliki JAR…

Konfigurowanie Eclipse IDE z WebDriverem

When the file browser opens:

  1. Select the JAR files downloaded from the Selenium website in Step 3.
  2. Kliknij Otwarte.
  3. The files will be added to the library list.

DodawanieSeleniumDoEclipse

6. Add all JAR files from inside and outside the libs folder. Your Properties dialog should now look similar to the image below.

Konfigurowanie Eclipse IDE z WebDriverem

7. Na koniec kliknij OK. Selenium libraries are now imported into your project.

Browser Driver Servers

HTMLUnit is the only browser that WebDriver can automate directly — no separate component is required. For all other browsers, a separate program called a Serwer sterowników jest potrzebne.

A driver server is specific to each browser. You can download these drivers from the Selenium oficjalna strona.

Przeglądarka Driver Server Name Uwagi
Jednostka HTML Sterownik HTMLUnitDriver WebDriver drives HTMLUnit natively using HtmlUnitDriver — no additional server needed.
Firefox Sterownik Mozilla GeckoDriver Wymagane do Firefox 45 and above; created and maintained by Mozilla.
Internet Explorer Serwer sterowników programu Internet Explorer Available in 32-bit and 64-bit versions. Use the version matching your IE architecture.
Chrom Sterownik Chrome Functions as a full driver server. Supports Chrome v21 and higher.
Opera OperaKierowca Functions as a full driver server for Opera browser.
PhantomJS GhostDriver PhantomJS is a headless browser, similar to HTMLUnit.
Safari SafariDriver Functions as a full driver server for Safari browser.

FAQ

Potrzebujesz Java JDK, Eclipse IDE dla Java Developers, and the Selenium Sterownik sieciowy Java client JAR files downloaded from selenium.dev.

Right-click your project, choose Properties, go to Java Build Path, click Add External JARs, then select all JARs from the Selenium download folder including those inside the libs subfolder.

Selenium supports ChromeDriver, GeckoDriver (Firefox), SafariDriver, OperaDriver, and Internet Explorer Driver Server. Only HTMLUnit requires no separate driver server.

Yes. You can use any Java IDE such as IntelliJ IDEA or NetBeans, or run tests from the command line using Maven or Gradle as your build tool.

Yes. Chrome and Firefox both support headless mode via their driver options, allowing tests to run without a visible browser window for faster CI/CD pipelines.

Podsumuj ten post następująco: