Esempio n. 1
0
 def amazonPageList(self):
     product_Prices= self.browser.find_by_class_name('a-offscreen')
     product_Names= self.browser.find_element_by_xpath("//h2[@data-attribute]")
     for i in range(0,len(product_Prices),1):
         text="{}-ürün İsmi:{}- ürün fiyatı: {}\n".format(i+1,product_Names[i].text,product_Prices[i].get_attribute("innerHTML"))
         print(text)
         file.FileFunctions(text)
     self.browser.quit()
Esempio n. 2
0
    def takeInformation(self):
        try:
            w = WebDriverWait(self.driver, 5)
            w.until(
                expected_conditions.presence_of_element_located(
                    (By.XPATH, '//*[@id="divResultTable"]/thead/tr/th[1]'
                     )))  # Check whether Drowpdown box of cities by xpath.
            print("Can take information")
        except TimeoutException:
            print("Can't take information")
        for c in range(1, 2, 1):
            city = 'Sehir'
            file.FileFunctions(city)
            for i in range(1, 7, 1):
                text = self.driver.find_element_by_xpath(
                    '//*[@id="divResultTable"]/thead/tr/th[{}]'.format(i)).text
                file.FileFunctions(text)
            rowCounter = 0

        for j in range(1, 10000000, 1):
            rowCounter += 1
            columnCounter = 0
            try:
                for j in range(1, 2, 1):
                    file.FileFunctions(self.cityName)
                    for i in range(1, 7, 1):
                        columnCounter += 1
                        text = self.driver.find_element_by_xpath(
                            '//*[@id="divResultTable"]/tbody/tr[{}]/td[{}]/span'
                            .format(rowCounter, columnCounter)).text
                        file.FileFunctions(text)
                        # print('geri geldi mi')
            except:
                static.Foo.columnIndexDecrease(self)
                Browser.changePage(self)
                rowCounter = 1
                columnCounter = 1
                print('exception geldi breakten onmceeee')
                pass
                print('exception geldi bu son')
Esempio n. 3
0
 def amazonPageList(self):
     product_Names = self.browser.find_elements_by_xpath(
         "//h2[@data-attribute]")
     link_List = []
     title = []
     for i in range(0, len(product_Names), 1):
         product_Description_Link = self.browser.find_element_by_xpath(
             "//a[@title=\"{}\"]".format(product_Names[i].text))
         link_List.append(product_Description_Link.get_attribute("href"))
         title.append(product_Names[i].text)
     for i in range(0, len(product_Names), 1):
         self.browser.get(link_List[i])
         description = self.browser.find_element_by_id(
             'feature-bullets').text
         text2 = (
             "\n\nTitle: {} \n-------------------------Description-------------------------\n{}\n\n"
         ).format(title[i], description)
         print(text2)
         file.FileFunctions(text2)
     self.browser.quit()