I tried automating the below code with headful mode and it works but not in headless mode. Throws a lot of javascript errors and finally says unable to find the element.
chrome_options = Options()
chrome_options.headless = True
chrome_options.add_experimental_option("excludeSwitches", ['enable-automation'])
chrome_options.add_argument(
"user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36")
chrome_options.add_argument("--remote-debugging-port=9222")
driver = webdriver.Chrome('chromedriver.exe',options=chrome_options)
driver.get('https://www.southwest.com/air/low-fare-calendar/select-dates.html?adultPassengersCount=1¤cyCode=USD&departureDate=2021-02-01&destinationAirportCode=MCO&originationAirportCode=ALB&passengerType=ADULT&returnAirportCode=&returnDate=&tripType=oneway')
time.sleep(2)
driver.find_element_by_xpath('//div[@class="flyout-trigger list-box"]').click()
time.sleep(1)
driver.find_element_by_id("Listbox_10--item-3").click()
time.sleep(1)
driver.save_screenshot("screenshot_after.png")
driver.quit()
chrome_options.add_argument("--window-size=1920,1080")