python-3.x - 使用 selenium 抓取博彩网站的网页。不完整的事件列表
问题描述
我编写了一个程序来从“Eurobet.it”网站获得一些赔率,使用 selenium 打开包含“ChanceMix”的页面。似乎它有效,但是当游戏发生在多个日期时,我得到的列表是不完整的。它仅包含第一个/第二个日期的日期,但不包含下一个日期。我尝试了各种解决方案,但没有结果。有人能帮我吗?
这是我的代码:
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import ui
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
link = 'https://www.eurobet.it/it/scommesse/#!/calcio/eu-champions-league/'
driver = webdriver.Chrome()
driver.get(link)
# Find the "ChanceMix" button by xpath and store it as a webdriver object
element = driver.find_element_by_xpath("//a[contains(text(), 'ChanceMix')]")
# Click on the "ChanceMix" button to open the relevant page
element.click()
# Find the list of games
Games = ui.WebDriverWait(driver, 10).until(EC.visibility_of_all_elements_located((By.CSS_SELECTOR, "div.box-sport")))
# Print the list of games
for x in range(0,len(Games)): print(Games[x].text)
解决方案
推荐阅读
- unity3d - 如何知道 AR 空间中的物体位置?(台式机和移动设备之间的行为不一致)
- routing - 使用 OSM 数据创建路由?
- c++ - C++ 成员变量被非成员函数覆盖
- c# - 是否可以制作包含 .NET Core Framework 的 .NET Core DLL?
- google-apps-script - HTTP 请求在 Playground 上工作不适用于 Google App 脚本
- flutter - 即使在 DateTimePickerFormField Flutter 中选择日期和时间后,FromDateTime 值也设置为 NULL
- r - 有没有办法使用 diana 和 parLapply 并行进行聚类?
- android - 通过 Java 从 Kotlin 访问内部方法
- php - 没有 Laravel 的 Eloquent 分页
- angular - Angular:ag grid navigateToNextRow Callback 不知道这个