Aktywne Wpisy

oyche +571
czwartafaza +384
Siedzę tutaj już z 10 lat i główna to od dawna był psychiatryk, ale ostatnio mirko to też niezłe Tworki ( ͡° ͜ʖ ͡°) Jakieś kręcenie korbą, co drugi wpis to nienawiść do kobiet, wyśmiewanie Uznańskiego bo wykopkom nie podoba się jego żona czy coś. A połowy szamba nawet nie widzę bo wszystko wrzucam na czarnolistę.
Nie ma już miejsca w internecie które byłoby normalne. Kiedyś były fora,
Nie ma już miejsca w internecie które byłoby normalne. Kiedyś były fora,





Mireczki, próbuję się pobawić Pythonem trochę; przy pomocy GPT, nie jestem programistą. Chcę stworzyć skrypt, używając Selenium, który automatycznie loguje się do Librusa i natknąłem się na problem. Chat kręci się w kółko i nie jest chyba w stanie dojść do sedna problemu.
Ale do rzeczy. Skrypt wyszukuje poprawnie przycisk LIBRUS SYNEGRIA, klika go, potem poprawnie lokalizuje przycisk ZALOGUJ i go klika. Ale po przejściu do formularza logowania, nie wpisuje nazwy użytkownika i hasła. Jakby nie widział w ogóle formularza? Nie wiem. Może jest ktoś na tagu, kto mógłby rzucić na to okiem i pokierować w odpowiedniem kierunku?
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expectedconditions as EC
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
import time
driverpath = '/usr/local/bin/chromedriver'
chromeoptions = Options()
chromeoptions.binarylocation = '/Applications/Brave Browser.app/Contents/MacOS/Brave Browser'
chromeoptions.addargument("--no-sandbox")
chromeoptions.addargument("--disable-dev-shm-usage")
service = Service(driverpath)
driver = webdriver.Chrome(service=service, options=chromeoptions)
try:
print("Navigating to the main page")
driver.get('https://portal.librus.pl/rodzina')
print("Waiting for the cookie consent button to be visible")
consentbutton = WebDriverWait(driver, 20).until(
EC.visibilityofelement_located((By.XPATH, '//*[@id="consent-categories-description"]/div[2]/div/div/button[2]'))
)
print("Cookie consent button found, clicking it.")
consentbutton.click()
time.sleep(3)
print("Waiting for the LIBRUS SYNERGIA button")
librusbutton = WebDriverWait(driver, 20).until(
EC.elementtobeclickable((By.XPATH, '/html/body/nav/div/div[1]/div/div[2]/a[3]'))
)
librusbutton.click()
time.sleep(3)
print("Waiting for the ZALOGUJ button")
zalogujbutton = WebDriverWait(driver, 20).until(
EC.elementtobeclickable((By.XPATH, '/html/body/nav/div/div[1]/div/div[2]/div/a[2]'))
)
zalogujbutton.click()
time.sleep(3)
print("Waiting for the login form to load")
usernamefield = WebDriverWait(driver, 20).until(
EC.visibilityofelementlocated((By.ID, 'Login'))
)
print("Username field found.")
usernamefield.sendkeys('username')
passwordfield = WebDriverWait(driver, 20).until(
EC.visibilityofelementlocated((By.ID, 'Pass'))
)
print("Password field found.")
passwordfield.sendkeys("password")
print("Clicking the submit button")
submitbutton = driver.findelement(By.ID, 'LoginBtn')
submitbutton.click()
print("Waiting for the next page to load...")
time.sleep(10)
except Exception as e:
print(f"An error occurred: {e}")
input("Press Enter to close the browser...")
driver.quit()
@venomik: