Skip to content

Commit

Permalink
Update selenium.py
Browse files Browse the repository at this point in the history
format change
  • Loading branch information
chengxuan-xia authored Aug 3, 2023
1 parent 396aae5 commit b6e7488
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions chromegpt/tools/selenium.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

from chromegpt.tools.utils import (
find_parent_element_text,
get_all_text_elements,
prettify_text,
truncate_string_from_last_occurrence,
)
Expand Down Expand Up @@ -317,7 +316,9 @@ def scroll(self, direction: str) -> str:
return self.describe_website()

def _get_website_main_content(self, soup: BeautifulSoup) -> str:
texts = [element.get_text(separator=' ') for element in soup.find_all(string=True)]
texts = [
element.get_text(separator=' ') for element in soup.find_all(string=True)
]
pretty_texts = [prettify_text(text) for text in texts]
if not pretty_texts:
return ""
Expand All @@ -337,7 +338,11 @@ def _get_interactable_elements(self, soup: BeautifulSoup) -> str:
tag.name == "button"
or (tag.name == "div" and tag.get("role") == "button")
or tag.name == "a"
or (tag.name == "input" and tag.get("type") in ["checkbox", "submit", "button", "radio", "reset"])
or (
tag.name == "input"
and tag.get("type")
in ["checkbox", "submit", "button", "radio", "reset"]
)
or tag.has_attr("data-href")
)
)
Expand Down

0 comments on commit b6e7488

Please sign in to comment.