Skip to content

Commit ea404e8

Browse files
Lucas FaudmanLucas Faudman
authored andcommitted
more types annos and formatting
1 parent c392f4c commit ea404e8

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/souperscraper/souperscraper.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,7 @@ def __init__(self,
104104
selenium_service_kwargs["executable_path"] = str(executable_path)
105105

106106
# Import Selenium WebDriver class, Service class, and Options class for webdriver_type or use the override classes
107-
selenium_webdriver_cls, selenium_service_cls, selenium_options_cls = import_webdriver(
108-
selenium_webdriver_type)
107+
selenium_webdriver_cls, selenium_service_cls, selenium_options_cls = import_webdriver(selenium_webdriver_type)
109108
selenium_webdriver_cls = selenium_webdriver_cls_override or selenium_webdriver_cls
110109
selenium_service_cls = selenium_service_cls_override or selenium_service_cls
111110
selenium_options_cls = selenium_options_cls_override or selenium_options_cls
@@ -386,27 +385,27 @@ def scroll_to(self, element: WebElement) -> WebElement:
386385
"arguments[0].scrollIntoView(true);", element)
387386
return element
388387

389-
def scroll_to_element(self, locator, locator_value):
388+
def scroll_to_element(self, locator: str, locator_value: str) -> WebElement:
390389
"""Scroll to element with locator and locator_value"""
391390
element = self.find_element(locator, locator_value)
392391
self.scroll_to(element)
393392
return element
394393

395394
# BY TEXT SHORTCUTS
396395

397-
def find_element_by_text(self, text):
396+
def find_element_by_text(self, text: str) -> WebElement:
398397
"""Find element by text with xpath"""
399398
return self.find_element_by_xpath(f"//*[text()='{text}']")
400399

401-
def find_elements_by_text(self, text):
400+
def find_elements_by_text(self, text: str) -> WebElement:
402401
"""Find elements by text with xpath"""
403402
return self.find_elements_by_xpath(f"//*[text()='{text}']")
404403

405-
def wait_for_element_by_text(self, text, timeout=3.0, poll_frequency=0.5, ignored_exceptions=None):
404+
def wait_for_element_by_text(self, text: str, timeout=3.0, poll_frequency=0.5, ignored_exceptions=None) -> WebElement:
406405
"""Wait for element by text with xpath"""
407406
return self.wait_for_presence_of_element_located_by_xpath(f"//*[text()='{text}']", timeout=timeout, poll_frequency=poll_frequency, ignored_exceptions=ignored_exceptions)
408407

409-
def scroll_to_element_by_text(self, text):
408+
def scroll_to_element_by_text(self, text: str) -> WebElement:
410409
"""Scroll to element by text with xpath"""
411410
element = self.find_element_by_text(text)
412411
self.scroll_to(element)

0 commit comments

Comments
 (0)