Skip to content

Commit

Permalink
Add type hint
Browse files Browse the repository at this point in the history
  • Loading branch information
AlirezaSoltaniJazi committed Oct 9, 2023
1 parent 9cf44fc commit 0d9bce5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions pages/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@ def __init__(self, browser: WebDriver, explicit_wait: float = 5):
self._browser = browser
self._explicit_wait = WebDriverWait(browser, explicit_wait)

def get_link_titles(self):
def get_link_titles(self) -> list[str]:
links: list[WebElement] = self._explicit_wait.until(
expected_conditions.visibility_of_all_elements_located(self._RESULT_LINKS)
)
titles = [link.text for link in links]
LOGGER.info('Result Titles', extra={'Titles': titles})
return titles

def get_search_input_text(self):
def get_search_input_text(self) -> str:
search_input: WebElement = self._explicit_wait.until(
expected_conditions.visibility_of_element_located(self._SEARCH_INPUT)
)
search_input_text = search_input.get_attribute('value')
LOGGER.info('Search Input Data', extra={'Text': search_input_text})
return search_input_text

def get_page_title(self):
def get_page_title(self) -> str:
page_title: str = self._browser.title
LOGGER.info('Page Title', extra={'Title': page_title})
return page_title
2 changes: 1 addition & 1 deletion pages/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def __init__(self, browser: WebDriver, explicit_wait: float = 5):
def load_search_page(self) -> None:
self._browser.get(self._URL)

def search_value(self, phrase: str):
def search_value(self, phrase: str) -> None:
search_input: WebElement = self._explicit_wait.until(
expected_conditions.visibility_of_element_located(self._SEARCH_INPUT_FIELD)
)
Expand Down

0 comments on commit 0d9bce5

Please sign in to comment.