Attempting to parse flights data selenium webdriver. Kayak gives a cookie box message straight away:
“Accept All” button
<button role="button" class="RxNS RxNS-mod-stretch RxNS-mod-variant-outline RxNS-mod-theme-base RxNS-mod-shape-default RxNS-mod-spacing-base RxNS-mod-size-small" tabindex="0" aria-disabled="false"><div class="RxNS-button-container"><div class="RxNS-button-content">Accept all</div></div></button>
<div class="RxNS-button-container"><div class="RxNS-button-content">Accept all</div></div>
Website: https://www.kayak.co.uk/flights/LON-MXP/2024-06-14/2024-06-16?fs=takeoff=1724,2200__1628,2200;stops=~0&sort=bestflight_a
The code:
chrome_options = Options()
chrome_options.add_argument("_tt_enable_cookie=1")
url = "https://www.kayak.co.uk/flights/LON-MXP/2024-06-14/2024-06-16?fs=takeoff=1724,2200__1628,2200;stops=~0&sort=bestflight_a"
driver = webdriver.Chrome(executable_path=r'C:UsersAdminLocal DocumentsPythonflights2chromedriver.exe')
driver.maximize_window()
driver.implicitly_wait(10)
driver.get(url)
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "button#RxNS RxNS-mod-stretch RxNS-mod-variant-outline RxNS-mod-theme-base RxNS-mod-shape-default RxNS-mod-spacing-base RxNS-mod-size-small > div"))).click()
There is no button id or other identifiers to click it. Anything I try returns “TimeoutException”
Thanks in advance.