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¤cyCode=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.
-
I see the same error on accessing the url even manually.undetected Selenium– undetected Selenium2021-01-27 19:40:23 +00:00Commented 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.Svj– Svj2021-01-27 19:52:00 +00:00Commented Jan 27, 2021 at 19:52
Add a comment
|
1 Answer
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
4 Comments
Svj
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:
PDHide
i am not getting any error could you ask as a different question with relevant screen shots
PDHide
trye adding wait or sleep and see if any error is there
Svj
PDHide - here is the question. stackoverflow.com/questions/65928302/…