Created
February 16, 2025 23:15
-
-
Save pjastr/a69edfa11da9bf2a35f7faea1bfb3a0b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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