From aca5d2667d67caa019dd64a6b952c8fcd851cbda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frane=20=C4=86alu=C5=A1i=C4=87?= Date: Tue, 16 Sep 2025 15:41:29 +0200 Subject: [PATCH] updated accept cookies button in return_flight and one_way_flight function --- scraper.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scraper.py b/scraper.py index 8efb762..20a4e14 100644 --- a/scraper.py +++ b/scraper.py @@ -32,7 +32,7 @@ def return_flight(self, flyout, flyback, orig, dest, adults='1', teens='0', chil # close cookies in button tag with cookie-popup-with-overlay__button class try: - self.driver.find_element(By.CLASS_NAME, 'cookie-popup-with-overlay__button').click() + self.driver.find_element(By.CLASS_NAME, 'cookie-popup-with-overlay__button-settings').click() except Exception as e: print(f'Error closing cookies: {e}') @@ -122,11 +122,11 @@ def one_way_flight(self, flyout, orig, dest, adults='1', teens='0', children='0' # close cookies in button tag with cookie-popup-with-overlay__button class try: # wait till button with class name cookie-popup-with-overlay__button is clickable - WebDriverWait(self.driver, 10).until(EC.element_to_be_clickable((By.CLASS_NAME, 'cookie-popup-with-overlay__button'))) + WebDriverWait(self.driver, 10).until(EC.element_to_be_clickable((By.CLASS_NAME, 'cookie-popup-with-overlay__button-settings'))) # Q: what do i need to import for EC? # A: from selenium.webdriver.support import expected_conditions as EC # click the button - self.driver.find_element(By.CLASS_NAME, 'cookie-popup-with-overlay__button').click() + self.driver.find_element(By.CLASS_NAME, 'cookie-popup-with-overlay__button-settings').click() except Exception as e: print(f'Error closing cookies: {e}') @@ -177,7 +177,7 @@ def close(self): # test if __name__ == '__main__': # create the object - ryanair = RyanAir(headless=True) + ryanair = RyanAir(headless=False) # get the data prices= ryanair.one_way_flight('2023-05-25', 'MAN', 'VLC')