Skip to content

Commit

Permalink
Add another debug screenshot and improve variable naming
Browse files Browse the repository at this point in the history
Since the driver.js_click method was added, a screenshot should be taken
(if run with the --debug-screenshots) flag to more easily debug when
that click fails.
  • Loading branch information
jdholtz committed Jul 3, 2024
1 parent fe3dd48 commit c94f737
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/fare_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ def _get_change_flight_page(self, reservation_info: JSON) -> Tuple[JSON, List[JS

# Next, get the search information needed to change the flight
logger.debug("Retrieving search information for the current flight")
info = reservation_info["_links"]["change"]
change_link = reservation_info["_links"]["change"]

# The change link does not exist, so skip fare checking for this flight
if info is None:
if change_link is None:
raise FlightChangeError("Flight cannot be changed online")

site = BOOKING_URL + info["href"]
response = make_request("GET", site, self.headers, info["query"], max_attempts=7)
site = BOOKING_URL + change_link["href"]
response = make_request("GET", site, self.headers, change_link["query"], max_attempts=7)

return response["changeFlightPage"], fare_type_bounds

Expand Down
1 change: 1 addition & 0 deletions lib/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ def _get_driver(self) -> Driver:

logger.debug("Loading Southwest home page (this may take a moment)")
driver.open(BASE_URL)
self._take_debug_screenshot(driver, "after_page_load.png")
driver.js_click("(//div[@data-qa='placement-link'])[2]")
return driver

Expand Down

0 comments on commit c94f737

Please sign in to comment.