Boa tarde, turma. Estou fazendo um web scraping com Python com o intuito de automatizar alguns levantamentos de dados que faço por hobby.
Neste scraping eu consegui avançar até a parte que preciso selecionar uma temporada específica no link https://www.ogol.com.br/edicao_actual.php?compet_id=5
Depois que eu selecionar a temporada, vou selecionar um clube em específico e seguir a caminhada.
O código que estou usando é:
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from time import sleep
import openpyxl
# Abrir o site
driver = webdriver.Chrome()
driver.get("https://www.ogol.com.br/")
sleep(10)
# Clicar em "Competições"
competicoes = driver.find_element(By.XPATH, "//a[@data-id='475']")
competicoes.click()
sleep(10)
# Pesquisar a liga
liga = driver.find_element(By.XPATH, "//a[@href='/edicao_actual.php?compet_id=5']")
liga.click()
sleep(10)
# Selecionar a temporada
dropdown_temporadas = driver.find_element(By.XPATH, "//select[@class='chosen-select']")
opcoes_anos = Select(dropdown_temporadas)
opcoes_anos.select_by_visible_text('2018/19')
sleep(10)
O erro retornado é:
Selecionar a temporada
dropdown_temporadas = driver.find_element(By.XPATH, "//select[@class='chosen-select']") opcoes_anos = Select(dropdown_temporadas) opcoes_anos.select_by_visible_text('2018/19') Traceback (most recent call last): File "", line 1, in File "C:\Users\stefa\OneDrive\Área de Trabalho\Automatizador de processos\stefano\Lib\site-packages\selenium\webdriver\support\select.py", line 117, in select_by_visible_text self._set_selected(opt) File "C:\Users\stefa\OneDrive\Área de Trabalho\Automatizador de processos\stefano\Lib\site-packages\selenium\webdriver\support\select.py", line 214, in _set_selected option.click() File "C:\Users\stefa\OneDrive\Área de Trabalho\Automatizador de processos\stefano\Lib\site-packages\selenium\webdriver\remote\webelement.py", line 93, in click self._execute(Command.CLICK_ELEMENT) File "C:\Users\stefa\OneDrive\Área de Trabalho\Automatizador de processos\stefano\Lib\site-packages\selenium\webdriver\remote\webelement.py", line 394, in _execute return self._parent.execute(command, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\stefa\OneDrive\Área de Trabalho\Automatizador de processos\stefano\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 344, in execute self.error_handler.check_response(response) File "C:\Users\stefa\OneDrive\Área de Trabalho\Automatizador de processos\stefano\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 229, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable: Element is not currently visible and may not be manipulated (Session info: chrome=118.0.5993.71) Stacktrace: GetHandleVerifier [0x00007FF7D35A8EF2+54786] (No symbol) [0x00007FF7D3515612] (No symbol) [0x00007FF7D33CA64B] (No symbol) [0x00007FF7D33CF116] (No symbol) [0x00007FF7D33D115F] (No symbol) [0x00007FF7D33D1250] (No symbol) [0x00007FF7D340F15C] (No symbol) [0x00007FF7D3402DE1] (No symbol) [0x00007FF7D342BE6A] (No symbol) [0x00007FF7D34022E6] (No symbol) [0x00007FF7D342C080] (No symbol) [0x00007FF7D3444D02] (No symbol) [0x00007FF7D342BC43] (No symbol) [0x00007FF7D3400941] (No symbol) [0x00007FF7D3401B84] GetHandleVerifier [0x00007FF7D38F7F52+3524194] GetHandleVerifier [0x00007FF7D394D800+3874576] GetHandleVerifier [0x00007FF7D3945D7F+3843215] GetHandleVerifier [0x00007FF7D3645086+694166] (No symbol) [0x00007FF7D3520A88] (No symbol) [0x00007FF7D351CA94] (No symbol) [0x00007FF7D351CBC2] (No symbol) [0x00007FF7D350CC83] BaseThreadInitThunk [0x00007FFB8589257D+29] RtlUserThreadStart [0x00007FFB8666AA78+40]