Svj
Svj

Reputation: 491

Automation through Selenium Python Chrome

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.

Upvotes: 0

Views: 319

Answers (1)

PDHide
PDHide

Reputation: 19929

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

Upvotes: 1

Related Questions