Занимаюсь парсингом сайта
https://www.svyaznoy.ru/catalog/accessories/8936/6...
при попытке спарсить наличие выдает список пустых строк, time.sleep() пробовал Xpath правильный, что делать не знаю
from selenium import webdriver
from selenium.webdriver.common.by import By
import requests
from selenium.webdriver.chrome.options import Options
import time
class Parser():
def __init__(self,url):
options = webdriver.ChromeOptions()
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
options.add_argument("--disable-blink-features=AutomationControlled")
self.driver = webdriver.Chrome(options=options)
self.url = url
def parse(self):
self.list_of_towns = ['moskva','sankt-peterburg','arhangelsk','vladivostok','volgograd','voronezh','ekaterinburg','izhevsk','irkutsk','kazan','kemerovo','krasnodar','krasnoyarsk','murmansk','naberezhnye-chelny',
'nizhniy-novgorod','novosibirsk','omsk','perm','rostov-na-donu','saratov','samara','sochi','surgut','tver','tolyatti','tula','tyumen','ulyanovsk','ufa','habarovsk','chelyabinsk','yaroslavl']
self.cityes = []
try:
self.driver.get(self.url+'/availability')
#self.button = self.driver.find_element(By.XPATH,'//a[@class="b-product-tabs-link _nowrap"]').click()
self.driver.implicitly_wait(8)
self.scroll = self.driver.find_element(By.XPATH, '//span[@class="shops-other-remains"]').click()
html = self.driver.page_source
self.location = self.driver.find_element(By.XPATH,'//div[@class="b-shops-map__address-text"]').text
self.loc = self.location.split(',')
self.loc = self.loc[0]
self.location = self.driver.find_elements(By.XPATH, '//div[@class="b-shops-map__address-text"]')
time.sleep(2)
self.nalichie = self.driver.find_elements(By.XPATH,'//span[@class="b-tooltip-new s-tooltip _up _hover-mode"]')
print([x.text for x in self.location])
print([y.text for y in self.nalichie])
finally:
pass
p = Parser('https://www.svyaznoy.ru/catalog/accessories/8936/6270567/availability/moskva#mainContent')
p.parse()