Skip to content

Commit

Permalink
BUGFIX: Selenium Driver object reference was included in the browsing…
Browse files Browse the repository at this point in the history
… results for some reason (Significant-Gravitas#3642)

* * there is really no need to return the  reference to the Selenium driver along with the text summary and list of links.

* * removing unused second return value from browse_website()

* * updated cassette

* * updated YAML cassette for test_browse_website

* * after requirements reinstall, another update YAML cassette for test_browse_website

* * another update YAML cassette for test_browse_website, only as a placholder commit to trigger re-testing due to some docker TCP timeout issue

* * another update YAML cassette for test_browse_website

---------

Co-authored-by: batyu <batyu@localhost>
  • Loading branch information
bszollosinagy and batyu authored May 4, 2023
1 parent 7d23452 commit ea08050
Show file tree
Hide file tree
Showing 3 changed files with 174 additions and 1,175 deletions.
6 changes: 3 additions & 3 deletions autogpt/commands/web_selenium.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
'"url": "<url>", "question": "<what_you_want_to_find_on_website>"',
)
@validate_url
def browse_website(url: str, question: str) -> tuple[str, WebDriver]:
def browse_website(url: str, question: str) -> str:
"""Browse a website and return the answer and links to the user
Args:
Expand All @@ -50,7 +50,7 @@ def browse_website(url: str, question: str) -> tuple[str, WebDriver]:
# These errors are often quite long and include lots of context.
# Just grab the first line.
msg = e.msg.split("\n")[0]
return f"Error: {msg}", None
return f"Error: {msg}"

add_header(driver)
summary_text = summary.summarize_text(url, text, question, driver)
Expand All @@ -60,7 +60,7 @@ def browse_website(url: str, question: str) -> tuple[str, WebDriver]:
if len(links) > 5:
links = links[:5]
close_browser(driver)
return f"Answer gathered from website: {summary_text} \n \n Links: {links}", driver
return f"Answer gathered from website: {summary_text} \n \n Links: {links}"


def scrape_text_with_selenium(url: str) -> tuple[WebDriver, str]:
Expand Down
Loading

0 comments on commit ea08050

Please sign in to comment.