Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}')
Expand Down Expand Up @@ -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}')

Expand Down Expand Up @@ -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')
Expand Down