You need to enable JavaScript to run this app. 使用Selenium抓取betaland.it意甲1X2赔率遇TimeoutException错误
优惠活动
大模型
产品
解决方案
定价
更多

使用Selenium抓取betaland.it意甲1X2赔率遇TimeoutException错误

Selenium爬取Betaland意甲赛事1X2赔率超时问题
  • 爬取目标:获取意大利博彩站点https://www.betaland.it/上意甲(Serie A)赛事对应的全部1X2赔率信息表格行数据
  • 访问前提:该站点仅对意大利地区IP开放访问权限,爬取前需配置意大利IP网络环境
  • 已实现的Selenium爬虫代码:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support.expected_conditions import presence_of_element_located
import time
import sys

url = 'https://www.betaland.it/sport/calcio/italia/serie-a-OIA-scommesse-sportive-online'

# chromedriver绝对路径配置
chrome_driver_path = '/Users/39340/PycharmProjects/pythonProject/chromedriver'

chrome_options = Options()
chrome_options.add_argument('--headless')

webdriver = webdriver.Chrome(
  executable_path=chrome_driver_path, options=chrome_options
)

with webdriver as driver:
    # 元素等待超时时间设置
    wait = WebDriverWait(driver, 10)

    # 发起页面请求
    driver.get(url)

    # 等待目标元素加载完成
    wait.until(presence_of_element_located((By.ID, 'prematch-container-events-1-33')))

    # 爬取赔率行数据
    results = driver.find_elements_by_class_name('simple-row')

    print(results)

    for quote in results:
        quoteArr = quote.text
        print(quoteArr)
        print()

    driver.close()
  • 运行报错栈:
Traceback (most recent call last):
  File "C:\Users\39340\PycharmProjects\pythonProject\main.py", line 41, in <module>
    wait.until(presence_of_element_located((By.ID, 'prematch-container-events-1-33')))
  File "C:\Users\39340\PycharmProjects\pythonProject\venv\lib\site-packages\selenium\webdriver\support\wait.py", line 80, in until
    raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message: 

内容的提问来源于stack exchange,提问作者Emanuele Bertuol

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.11.07 23:42:00