“Nie czytaj o testowaniu. Testuj.”
Lecimy z konkretem – pierwszy test w Selenium z Pythonem i Pytestem w parę minut.

🚀 TL;DR

  • Pobierz ChromeDriver
  • Skonfiguruj WebDriver options
  • Napisz test w Pytest
  • ✅ Profit
pip install selenium pytest

📦 Setup

from selenium import webdriver
import pytest

@pytest.fixture
def driver():
    options = webdriver.ChromeOptions()
    options.add_argument('--headless')  # tryb bez GUI
    driver = webdriver.Chrome(options=options)
    yield driver
    driver.quit()

🧪 Pierwszy test

def test_page_load_and_title(driver):
    driver.get("https://www.example.com")
    assert "Example Domain" in driver.title

💡 Na co uważać?

  • Nie zapomnij o yield – bez tego narobisz sobie zombie-chromów w tle.
  • --headless = twój przyjaciel na CI/CD.
  • Selenium to prawdziwa przeglądarka → nie pchaj tam wszystkiego. Tylko to, co trzeba.

🔍 Chcesz więcej?

Zajrzyj głębiej, jeśli czujesz głód wiedzy:


Bądź sprytny. Testuj sprytniej. 🔪