Python 3.x 美丽的汤找不到任何元素

Python 3.x 美丽的汤找不到任何元素,python-3.x,Python 3.x,我刚从网页抓取开始。我很难喝到美味的汤。我也尝试过将div类更改为其他类,但它总是返回[]。这是我的密码 import time from bs4 import BeautifulSoup from selenium import webdriver driver = webdriver.Chrome(executable_path="C:/Users/MuhIsmail/Downloads/cd79/chromedriver.exe") url = "https://www.cricbuzz

我刚从网页抓取开始。我很难喝到美味的汤。我也尝试过将div类更改为其他类,但它总是返回[]。这是我的密码

import time
from bs4 import BeautifulSoup
from selenium import webdriver

driver = webdriver.Chrome(executable_path="C:/Users/MuhIsmail/Downloads/cd79/chromedriver.exe")
url = "https://www.cricbuzz.com/cricket-match/live-scores"
driver.get(url)
driver.maximize_window()
time.sleep(4)
content = driver.page_source
soup = BeautifulSoup(content, "html.parser")
scores = soup.find_all('div', class_='col-xs-9 col-lg-9 dis-inline')
print(scores)
它返回[],因为页面上没有包含该类的元素

如果打开浏览器控制台并执行简单的

document.getElementsByClassName('col-xs-9 col-lg-9 dis-inline')
它不会返回任何结果

我也试过这个:

import requests
from bs4 import BeautifulSoup

url = "https://www.cricbuzz.com/cricket-match/live-scores"
r = requests.get(url)
soup = BeautifulSoup(r.content, 'html.parser')
scores = soup.find_all('div', {'class':'col-xs-9 col-lg-9 dis-inline'})
print(scores)
输出:

MLR vs SYS - SYS Won

在实际页面上…如果你看到MLR vs SYS…悉尼六人队以6个边门获胜…你能告诉我该队的id吗?试试分数=汤。找到'a',{'class':'cb-mat-mnu-itm cb ovr flo'。获取文本
MLR vs SYS - SYS Won