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')