-
Notifications
You must be signed in to change notification settings - Fork 1
Error al lanzar script #1
Description
Hola Sergio. Estoy intentando utilizar el script de python para scrapear las estadísticas de la liga. Una vez configurado todo sin error, cuando lanzo el script, al cabo de un rato, me devuelve este error:
221121 18:43:19 [INFO ] Moving to https://www.laliga.com/en-ES/advanced-stats (core.py:43) 221121 18:43:55 [ERROR ] TimeoutException by Selenium (network.py:60) 221121 18:43:55 [WARNING ] No advertisements found (core.py:73) 221121 18:43:55 [INFO ] Getting season (core.py:76) Traceback (most recent call last) ────────────────────────────────╮ │ /laliga-data/main.py:27 in run │ │ │ │ 24 │ logger.setLevel(logzero.DEBUG if verbose else logzero.INFO) │ │ 25 │ │ │ 26 │ scraper = LaLigaScraper() │ │ ❱ 27 │ scraper.get_player_data(num_players) │ │ 28 │ scraper.to_dataframe() │ │ 29 │ scraper.wrangle_dataframe() │ │ 30 │ scraper.to_csv() │ │ │ │ ╭──────────────────────────── locals ─────────────────────────────╮ │ │ │ num_players = 0 │ │ │ │ scraper = <laliga.core.LaLigaScraper object at 0x117fad0d0> │ │ │ │ verbose = False │ │ │ ╰─────────────────────────────────────────────────────────────────╯ │ │ │ │ /laliga-data/laliga/core.py:152 in get_player_data │ │ │ │ 149 │ │ │ │ logger.error('Unable to retrieve data') │ │ 150 │ │ │ 151 │ def get_player_data(self, num_players=0): │ │ ❱ 152 │ │ while competition := self._load_next_competition(): │ │ 153 │ │ │ time.sleep(10) │ │ 154 │ │ │ self.get_player_data_by_competition(competition, num_players) │ │ 155 │ │ │ │ ╭──────────────────────────── locals ─────────────────────────────╮ │ │ │ num_players = 0 │ │ │ │ self = <laliga.core.LaLigaScraper object at 0x117fad0d0> │ │ │ ╰─────────────────────────────────────────────────────────────────╯ │ │ │ │ /laliga-data/laliga/core.py:119 in _load_next_competition │ │ │ │ 116 │ │ │ │ yield build_url(tr.td.a['href']) │ │ 117 │ │ │ 118 │ def _load_next_competition(self): │ │ ❱ 119 │ │ competitions_div = self.webdriver.find_element_by_xpath(self.competitions_div_xp │ │ 120 │ │ self.webdriver.execute_script('window.scrollTo(0, 0);') │ │ 121 │ │ time.sleep(1) │ │ 122 │ │ competitions_div.click() │ │ │ │ ╭───────────────────────── locals ─────────────────────────╮ │ │ │ self = <laliga.core.LaLigaScraper object at 0x117fad0d0> │ │ │ ╰──────────────────────────────────────────────────────────╯ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ AttributeError: 'WebDriver' object has no attribute 'find_element_by_xpath'
¿Sabes a qué puede ser debido?
un saludo y gracias.