Reputation: 41
I want to get all today's big games from Bet365 (Warning its a gambling site!) but i only can get one which is the first game.
I try this but no working:
try:
driver.maximize_window()
driver.get("https://www.bet365.es/#/HO/")
driver.implicitly_wait(5)
except:
print("No se ha podido acceder a Bet365. Comprueba si la página funciona correctamente y no estas bloqueado de ella.")
try:
partidos_destacados = driver.find_element_by_class_name("fh-ParticipantFixtureTeam_TruncateName")
for i in partidos_destacados:
print(i.text)
except:
print("No se han podido leer los partidos destacados. Comprueba si ha cambiado el nombre del class en el HTML de BET365")
There are many divs with class name "fh-ParticipantFixtureTeam_TruncateName" and I need get all of this.
Upvotes: 0
Views: 967
Reputation: 41
I encountered the error. Im using driver.find_element_by_class_name but i need use driver.find_elements_by_class_name.
This is the code fixed:
try:
driver.maximize_window()
driver.get("https://www.bet365.es/#/HO/")
driver.implicitly_wait(5)
except:
print("No se ha podido acceder a Bet365. Comprueba si la página funciona correctamente y no estas bloqueado de ella.")
try:
partidos_destacados = driver.find_elements_by_class_name("fh-ParticipantFixtureTeam_TruncateName")
for i in partidos_destacados:
print(i.text)
except:
print("No se han podido leer los partidos destacados. Comprueba si ha cambiado el nombre del class en el HTML de BET365")
Upvotes: 1