Skip to content

Instantly share code, notes, and snippets.

@pjastr
Created February 16, 2025 23:15
Show Gist options
  • Select an option

  • Save pjastr/a69edfa11da9bf2a35f7faea1bfb3a0b to your computer and use it in GitHub Desktop.

Select an option

Save pjastr/a69edfa11da9bf2a35f7faea1bfb3a0b to your computer and use it in GitHub Desktop.
from selenium import webdriver
from selenium.webdriver.common.by import By
import time
# Utworzenie instancji przeglądarki (tutaj Chrome)
driver = webdriver.Chrome() # Upewnij się, że chromedriver jest w PATH
try:
# Otwórz stronę piojas.pl
driver.get("https://piojas.pl")
# Poczekaj kilka sekund, aby strona się załadowała
time.sleep(5)
# Pobierz i wyświetl tytuł strony
print("Tytuł strony:", driver.title)
# Przykładowy test: sprawdzenie obecności elementu <body>
body_element = driver.find_element(By.TAG_NAME, "body")
if body_element:
print("Element <body> został znaleziony na stronie.")
else:
print("Element <body> nie został znaleziony.")
finally:
# Zamknij przeglądarkę
driver.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment