def start_price_search(self, driver): if self.transaction_control and (self.link != '0' and self.link != 0): try: driver.get(self.link) time.sleep(0.5) WebDriverWait(driver, 10).until( EC.visibility_of_all_elements_located( (By.CSS_SELECTOR, "div.container-semiboxed div.row"))) tag = driver.find_elements_by_css_selector( 'div.container-semiboxed div.row div.g-mb-20 s') if tag: price = number_transform(tag[0].text) self.np = price tag2 = driver.find_elements_by_css_selector( 'div.container-semiboxed div.row div.g-mb-20 span') if tag2: action = number_transform(tag2[0].text) self.ap = action else: tag3 = driver.find_elements_by_css_selector( 'div.container-semiboxed div.row div.g-mb-20 span') if tag3: price = number_transform(tag3[0].text) self.np = price except: pass else: pass
def start_price_search(self, driver): if self.transaction_control and (self.link != '0' and self.link != 0): try: driver.get(self.link) time.sleep(1) WebDriverWait(driver, 10).until( EC.visibility_of_all_elements_located( (By.CSS_SELECTOR, "span.tg-bookprice"))) time.sleep(1) tag = driver.find_elements_by_css_selector( 'span.tg-bookprice > del') if tag: price = number_transform(tag[0].text) self.np = price tag2 = driver.find_elements_by_css_selector( 'span.tg-bookprice > ins') if tag2: action = number_transform(tag2[0].text) self.ap = action else: tag3 = driver.find_elements_by_css_selector( 'span.tg-bookprice > ins') if tag3: price = number_transform(tag3[0].text) self.np = price except: pass else: pass
def start_price_search(self, driver): if self.transaction_control and (self.link != '0' and self.link != 0): try: driver.get(self.link) time.sleep(3) WebDriverWait(driver, 5).until( EC.presence_of_element_located( (By.CSS_SELECTOR, "div.xy"))) time.sleep(2) tag = driver.find_elements_by_css_selector('div.xy span.Av') if tag: price = number_transform(tag[0].text) self.np = price tag2 = driver.find_elements_by_css_selector( 'div.xy div.Cv') if tag2: action = number_transform(tag2[0].text) self.ap = action else: tag3 = driver.find_elements_by_css_selector('div.xy') if tag3: price = number_transform(tag3[0].text) self.np = price except: pass else: pass
def start_price_search(self, driver): if self.transaction_control and (self.link != '0' and self.link != 0): try: driver.get(self.link) time.sleep(2) WebDriverWait(driver, 10).until( EC.visibility_of_all_elements_located(( By.XPATH, "//div[@*='offer-cart']/div/div/div/div/div/div/div/div/span/span" ))) tag = driver.find_elements_by_xpath( "//div[@*='offer-cart']/div/div/div/div/div/div/div/div/span/span" ) if len(tag) == 1: price = number_transform(tag[0].text) self.np = price elif len(tag) == 2: action = number_transform(tag[0].text) self.ap = action price = number_transform(tag[1].text) self.np = price else: pass except: return None else: return None
def start_price_search(self, driver): if self.transaction_control and (self.link != '0' and self.link != 0): try: driver.get(self.link) time.sleep(1) WebDriverWait(driver, 10).until( EC.visibility_of_all_elements_located( (By.XPATH, "//div[@class='yprice price']"))) tag = driver.find_elements_by_xpath( "//span[@class='price-old']//span[@class='price']") if tag: price = number_transform(tag[0].text) self.np = price tag_two = driver.find_elements_by_xpath( "//div[@class='yprice price']") if tag_two: action = number_transform(tag_two[0].text) self.ap = action else: tag_three = driver.find_elements_by_xpath( "//div[@class='yprice price']") if tag_three: price = number_transform(tag_three[0].text) self.np = price except: pass else: pass
def start_price_search(self, driver): if self.transaction_control and (self.link != '0' and self.link != 0): try: driver.get(self.link) time.sleep(0.5) WebDriverWait(driver, 10).until( EC.visibility_of_all_elements_located( (By.CSS_SELECTOR, "div.content > p"))) time.sleep(1) tag = driver.find_elements_by_css_selector('div.content > p') if tag: if 'Возрастное ограничение' in tag[0].text: form_check = driver.find_elements_by_css_selector( 'form[method="POST"] div.control input') if form_check: form_check[0].click() form_btn = driver.find_elements_by_css_selector( 'form[method="POST"] div.control button') if form_btn: form_btn[0].click() time.sleep(2) tag2 = driver.find_elements_by_css_selector( 'div.content > p') if len(tag2) == 2: price = number_transform(tag2[0].text) self.np = price print(price) elif len(tag2) == 3: price = number_transform(tag2[0].text) self.np = price action = number_transform(tag2[1].text) self.ap = action elif len(tag2) == 4: price = number_transform(tag2[0].text) self.np = price action = number_transform(tag2[2].text) self.ap = action else: if len(tag) == 2: price = number_transform(tag[0].text) self.np = price elif len(tag) == 3: price = number_transform(tag[0].text) self.np = price action = number_transform(tag[1].text) self.ap = action elif len(tag) == 4: price = number_transform(tag[0].text) self.np = price action = number_transform(tag[2].text) self.ap = action except: pass else: pass
def start_price_search(self, driver): if self.transaction_control and (self.link != '0' and self.link != 0): try: driver.get(self.link) time.sleep(1) WebDriverWait(driver, 10).until( EC.presence_of_all_elements_located( (By.CSS_SELECTOR, "div#price"))) tag = driver.find_elements_by_css_selector("div#price") if tag: price = number_transform(tag[0].text) self.np = price tag_shop = driver.find_elements_by_css_selector( "div#old_price") if tag_shop: shop = number_transform(tag_shop[0].text) self.sp = shop except: pass else: pass
def start_price_search(self, driver): if self.transaction_control and (self.link != '0' and self.link != 0): try: driver.get(self.link) time.sleep(1) tag = driver.find_elements_by_xpath( "//div[@id='product_price']") if tag: price = number_transform(tag[0].text) self.np = price except: pass else: pass
def start_price_search(self, driver): if self.transaction_control and (self.link != '0' and self.link != 0): try: driver.get(self.link) time.sleep(3) try: city_tag = driver.find_element_by_xpath( "//a[@id='cityYes']") webdriver.ActionChains(driver).send_keys( Keys.ESCAPE).perform() except: pass time.sleep(0.5) WebDriverWait(driver, 10).until( EC.visibility_of_all_elements_located( (By.XPATH, "//*[@class='product__price']//div[@class='price']"))) tag = driver.find_elements_by_xpath( "//*[@class='product__price']//div[@class='old-price']") if tag: price = number_transform(tag[0].text) self.np = price tag_two = driver.find_elements_by_xpath( "//*[@class='product__price']//div[@class='price']") if tag_two: action = number_transform(tag_two[0].text) self.ap = action else: tag_three = driver.find_elements_by_xpath( "//*[@class='product__price']//div[@class='price']") if tag_three: price = number_transform(tag_three[0].text) self.np = price except: pass else: pass
def start_price_search(self, driver): if self.transaction_control and (self.link != '0' and self.link != 0): try: driver.get(self.link) time.sleep(1) WebDriverWait(driver, 10).until( EC.visibility_of_all_elements_located( (By.CSS_SELECTOR, "div.top-sale-block"))) time.sleep(2) tag = driver.find_elements_by_css_selector( 'div.top-sale-block > div:first-child > div:first-child > div:first-child > div:first-child > div:first-child > div:first-child > div:first-child > div:first-child > span' ) if len(tag) == 1: price = number_transform(tag[0].text) self.np = price elif len(tag) == 2: action = number_transform(tag[0].text) self.ap = action price = number_transform(tag[1].text) self.np = price except: pass else: pass
def start_price_search(self, driver): if self.transaction_control and (self.link != '0' and self.link != 0): try: driver.get(self.link) time.sleep(1) WebDriverWait(driver, 10).until( EC.presence_of_all_elements_located((By.XPATH, "//h3"))) tag = driver.find_elements_by_tag_name('h3') if tag: price = number_transform(tag[0].text) self.np = price except: pass else: pass
def start_price_search(self, driver): if self.transaction_control and (self.link != '0' and self.link != 0): try: driver.get(self.link) time.sleep(0.5) WebDriverWait(driver, 10).until( EC.visibility_of_all_elements_located( (By.XPATH, "//div[@class='book__price']"))) tag = driver.find_elements_by_xpath( "//div[@class='book__price']") if tag: price = number_transform(tag[0].text) self.np = price tag_two = driver.find_elements_by_xpath( "//div[@class='book__shop-details']") if tag_two: tag_three = tag_two[0].find_elements_by_tag_name('noindex') if tag_three: shop = number_transform(tag_three[0].text) self.sp = shop except: pass else: pass
def start_price_search(self, driver): if self.transaction_control and (self.link != '0' and self.link != 0): try: driver.get(self.link) time.sleep(1) WebDriverWait(driver, 10).until( EC.presence_of_all_elements_located( (By.XPATH, "//div[@class='product-prices']/span"))) tag = driver.find_elements_by_xpath( "//div[@class='product-prices']/span") if len(tag) == 2 and tag[1].text: price = number_transform(tag[1].text) self.np = price action = number_transform(tag[0].text) self.ap = action elif len(tag) == 2 and not tag[1].text: price = number_transform(tag[0].text) self.np = price else: pass except: pass else: pass
def start_price_search(self, driver): if self.transaction_control and (self.link != '0' and self.link != 0): try: driver.get(self.link) time.sleep(0.5) WebDriverWait(driver, 10).until( EC.visibility_of_all_elements_located( (By.XPATH, "//b[@style='font-size:14px']"))) tag = driver.find_elements_by_xpath( "//b[@style='font-size:14px']") if tag: price = number_transform(tag[0].text) self.np = price except: pass else: pass
def start_price_search(self, driver): if self.transaction_control and (self.link != '0' and self.link != 0): try: driver.get(self.link) time.sleep(2) WebDriverWait(driver, 10).until( EC.visibility_of_all_elements_located( (By.XPATH, "//span[@class='js__actualPrice']"))) tag = driver.find_elements_by_xpath( "//*[@class and contains(@title, 'Старая цена')]") if tag: price = number_transform(tag[0].text) self.np = price tag_two = driver.find_elements_by_xpath( "//span[@itemprop='price']") if tag_two: action = number_transform(tag_two[0].text) self.ap = action else: tag_three = driver.find_elements_by_xpath( "//span[@class='js__actualPrice']") if tag_three: price = number_transform(tag_three[0].text) self.np = price except: try: WebDriverWait(driver, 10).until( EC.visibility_of_all_elements_located( (By.XPATH, "//*[@class and contains(@title, 'Старая цена')]" ))) tag = driver.find_elements_by_xpath( "//*[@class and contains(@title, 'Старая цена')]") if tag: price = number_transform(tag[0].text) self.np = price tag_two = driver.find_elements_by_xpath( "//span[@itemprop='price']") if tag_two: action = number_transform(tag_two[0].text) self.ap = action else: tag_three = driver.find_elements_by_xpath( "//span[@class='js__actualPrice']") if tag_three: price = number_transform(tag_three[0].text) self.np = price except: pass else: pass
def start_price_search(self, driver): if self.transaction_control and (self.link != '0' and self.link != 0): try: driver.get(self.link) time.sleep(3) WebDriverWait(driver, 10).until( EC.presence_of_all_elements_located( (By.XPATH, "//div[@class='price js-product-price on-page']"))) time.sleep(2) tag = driver.find_elements_by_xpath( "//div[@class='price js-product-price on-page']") if tag: price = number_transform(tag[0].text) self.np = price time.sleep(0.5) else: return None except: return None else: return None