Skip to content

Commit

Permalink
tests: fixed browser search (when desc element not found)
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Sep 27, 2024
1 parent dc014cc commit bad47ef
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions gptme/tools/_browser_playwright.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,8 @@ def _list_results_google(page) -> str:
if h3:
title = h3.inner_text()
# desc has data-sncf attribute
desc = (
result.query_selector("[data-sncf]").inner_text().strip().split("\n")[0]
)
desc_el = result.query_selector("[data-sncf]")
desc = (desc_el.inner_text().strip().split("\n")[0]) if desc_el else ""
hits.append(SearchResult(title, url, desc))
return titleurl_to_list(hits)

Expand Down

0 comments on commit bad47ef

Please sign in to comment.