Python 3.x 使用selenium webdriver提取表中每行的最后一列时出现问题

Python 3.x 使用selenium webdriver提取表中每行的最后一列时出现问题,python-3.x,selenium-webdriver,extract,Python 3.x,Selenium Webdriver,Extract,您好,我正在尝试提取此网页中表格的最后一列(名为B): 这是我的剧本: #!/usr/bin/python3 # -*- coding: utf­-8 ­-*- from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.com

您好,我正在尝试提取此网页中表格的最后一列(名为B):

这是我的剧本:

#!/usr/bin/python3
# -*- coding: utf­-8 ­-*-

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC

options = Options()
options.headless = True
options.add_argument("window-size=1400,800")
options.add_argument("--no-sandbox")
options.add_argument("--disable-gpu")
options.add_argument("start-maximized")
options.add_argument("enable-automation")
options.add_argument("--disable-infobars")
options.add_argument("--disable-dev-shm-usage")

driver = webdriver.Chrome(options=options)

driver.get("https://www.oddsportal.com/matches/basketball/20200908/")

nb_bookies = [my_elem.text for my_elem in WebDriverWait(driver, 10).until(EC.presence_of_all_elements_located((By.XPATH, "//td[contains(@class, 'center info-value')]")))]

print(nb_bookies)

driver.close()
driver.quit()
以下是输出:

['12', '9', '8', '1', '8', '12']

这不是我们在网页中的代码。

我运行了您的代码,并且它的打印与表中最后一列B中的显示完全相同。请让我知道您期望的值和即将到来的值。在表中,我们有[35 6 5 27 24 5 11 9 3 27 2 34],我的代码有:[11',3',3',8',9',3',3',4',2',10',3',2',11']