0

I am testing Browser Automation through Selenium/Python. When I open the url (https://www.southwest.com/air/low-fare-calendar/select-dates.html?adultPassengersCount=1&currencyCode=USD&departureDate=2021-02-01&destinationAirportCode=DEN&originationAirportCode=ATL&passengerType=ADULT&returnAirportCode=&returnDate=&tripType=oneway) through normal chrome, it works. But when opening through Selenium/Python, it displays an error on the webpage. Looks like source website is expecting some cookies. How do I resolve this issue? Thanks.

2
  • I see the same error on accessing the url even manually. Commented Jan 27, 2021 at 19:40
  • what if you visit southwest.com/air/low-fare-calendar and select "one way" from Atlanta to Denver. This will direct you to next page which is the link on my original post. Now if you copy this link and paste into new tab it works. Commented Jan 27, 2021 at 19:52

1 Answer 1

1
options=ChromeOptions()
options.add_experimental_option(
    "excludeSwitches", ['enable-automation'])

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")
options.add_argument("--remote-debugging-port=9222")
driver = webdriver.Chrome(options=options)
driver.maximize_window()

It detects automation use this options and it will work

Sign up to request clarification or add additional context in comments.

4 Comments

I tried with headless mode and this driver.find_element_by_xpath('//div[@class="flyout-trigger list-box"]').click() creates an error. but it does work with non headless mode. any idea. below is the error: selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element:
i am not getting any error could you ask as a different question with relevant screen shots
trye adding wait or sleep and see if any error is there
PDHide - here is the question. stackoverflow.com/questions/65928302/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.