Exemplo n.º 1
0
 def search_for_info(self, address) -> Union[List[QuoteParser], str]:
     """
     Функция для получения списка значений результатов поиска, возвращает либо лист объектов QuoteParser или строку
     """
     self.data_search(
         address
     )  # запускает поиска веб-элементов и введение адреса в строку поиска
     time.sleep(2)
     list_info = []
     try:
         html_list = self.browser.find_element_by_id("mapFlyout")
         items = html_list.find_elements_by_tag_name("li")
         list_info = [QuoteParser(e) for e in items]
         if len(list_info) <= 0:
             other_format = self.browser.find_element_by_id(
                 "information_about_object")
             data = other_format.text
         return list_info
     except NoSuchElementException:
         print('NoSuchElementException raised by def search_for_inf')
     try:
         if len(list_info) <= 0:
             other_format = self.browser.find_element_by_id(
                 "information_about_object")
             data = other_format.text
             return data
     except NoSuchElementException:
         print('NoSuchElementException raised by def search_for_inf')
 def quotes(self) -> List[QuoteParser]:
     return [
         QuoteParser(e)
         for e in self.browser.find_elements_by_css_selector(
             QuotesPageLocators.QUOTE
         )
     ]
Exemplo n.º 3
0
 def quotes(self):
     """
     :return: all the 'div' tags from the page(website)
     """
     locator = QuotesPageLocators.QUOTES  # locates all the 'divs' in the website
     quote_div_tags = self.soup.select(locator)
     # print(quote_div_tags)
     # gets the content, author and tags from the 'div' tags
     return [QuoteParser(e) for e in quote_div_tags]
Exemplo n.º 4
0
    def quotes(self) -> List[QuoteParser]:
        """Returns the web page's quotes.

        Returns
        -------
        list
            A list of QuoteParser representing the web page's quotes.
        """
        locator = QuotesPageLocators.QUOTE
        quote_tags = self.soup.select(locator)
        return [QuoteParser(e) for e in quote_tags]
Exemplo n.º 5
0
    def quotes(self) -> List[QuoteParser]:
        """Returns the web page's quotes.

        Returns
        -------
        List[QuoteParser]
            A list of QuoteParser representing the web page's quotes.
        """

        quote_tags = self.browser.find_elements_by_css_selector(
            QuotesPageLocators.QUOTE)
        quote_parsers = [QuoteParser(e) for e in quote_tags]
        return quote_parsers
Exemplo n.º 6
0
 def quotes(self) -> List[QuoteParser]:
     locator = QuotePageLocators.QUOTE
     quote_tags = self.browser.find_elements_by_css_selector(locator)
     return [QuoteParser(e) for e in quote_tags]
Exemplo n.º 7
0
 def quotes(self):
     locator = QuotesPageLocators.QUOTE
     quote_tags = self.soup.select(locator)  # Here lies all the 'div.quote' tags. So we have a list of tags
     # containing the quotes.
     return [QuoteParser(e) for e in quote_tags] # We then pass each 'quote tags' to the 'QuoteParser'
Exemplo n.º 8
0
 def quotes(self) -> List[QuoteParser]:
     html_list = self.browser.find_element_by_id("mapFlyout")
     items = html_list.find_elements_by_tag_name("li")
     return [QuoteParser(e) for e in items]
Exemplo n.º 9
0
 def quotes(self):
     locator = QuotePageLocators.QUOTE
     quote_tags = self.browser.find_elements_by_css_selector(locator) # as we use elementS, plural, this will give all matching elements
     return [QuoteParser(e) for e in quote_tags]
Exemplo n.º 10
0
 def quotes(self):
     return [
         QuoteParser(e) for e in self.soup.select(QuotesPageLocators.QUOTE)
     ]
Exemplo n.º 11
0
 def quotes(self):
     locator = QuotesPageLocators.QUOTE
     quote_tags = self.soup.select(locator)
     for e in quote_tags:
         print(e)
     return [QuoteParser(e) for e in quote_tags]
Exemplo n.º 12
0
 def quotes(self):
     # created an object of a quote from a complete page and passed into
     return [
         QuoteParser(e) for e in self.soup.select(QuotePageLocater.QUOTE)
     ]
Exemplo n.º 13
0
 def quotes(self):
     locator = QuotesPageLocators.QUOTE  # find a locator
     quote_tags = self.soup.select(locator)  # select every quote
     return [QuoteParser(e) for e in quote_tags
             ]  # found tags but not string, that's bs4 tags
Exemplo n.º 14
0
 def quotes(self):
     locator = QuotesPageLocators.QUOTE
     quote_tags = self.page.select(locator)
     return [QuoteParser(e) for e in quote_tags]
Exemplo n.º 15
0
 def quotes(self):
     locator = PageLocators.QUOTE
     quote_tags = self.soup.select(locator)
     return [QuoteParser(qt) for qt in quote_tags]
Exemplo n.º 16
0
 def quotes(self):
     locator = QuotesPageLocators.QUOTES_LOCATOR
     quote_tags = self.soup.select(locator)
     return [QuoteParser(e) for e in quote_tags]
Exemplo n.º 17
0
 def quotes(self):
     locator = QuotesPageLocators.QUOTE
     quote_elements = self.browser.find_elements_by_css_selector(locator)
     return [QuoteParser(quote_element) for quote_element in quote_elements]
Exemplo n.º 18
0
 def quotes(self):
     locator = QuotesPageLocators.QUOTE
     quote_collection = self.soup.select(locator)
     return [QuoteParser(e) for e in quote_collection]