我正在尝试解析内所有跨度的文本,但是当我调用'soup_dc.find_all('div',{'class':'box-row-event'})''时,它只能找到我3 div,而不是全部(应该是7 div)
from selenium import webdriver
from bs4 import BeautifulSoup
import time
#Apri la pagina
driver = webdriver.Firefox(executable_path='/Applications/Python 3.7/geckodriver')
driver.get('https://www.eurobet.it/it/scommesse/?splash=false#!/calcio/se-superettan/')
time.sleep(3)
# Doppia chance
dc_button = driver.find_element_by_link_text('doppia chance')
dc_button.click()
time.sleep(15)
# Page source
source_dc = driver.page_source
soup_dc = BeautifulSoup(source_dc, 'lxml')
event_container = soup_dc.find_all('div', {'class': 'box-row-event'})
print(len(event_container)) #it shows only 3 and not 7
for event in event_container:
for div in event.find_all('div', {'class': 'ctn box-wrap'}):
for dc in div.find_all('span'):
print(dc.text)