【发布时间】:2018-01-01 11:32:13
【问题描述】:
总而言之,我怎样才能获得 XPath 以在我的脚本中消除可能性。
提供不同值的 XPath。
群组 = ".//div[contains(@class, 'gl-ParticipantOddsOnlyDarker gl')]"
xp_ba3 = ".//span[contains(@class, 'gl-Participa')]"
两个组的 XPath 需要和 xp_ba3 需要相同的长度和不同的长度才能正确运行(我相信)。
所需的 XPath 如下所示:
XPath://div[contains(@class, 'gl-Market_HasLabels')]/following-sibling::div[contains(@class, 'gl-Market_PWidth-12-3333')][1]//div[contains(@class, 'gl-ParticipantOddsOnly')]。
这可行,但是当我添加此逻辑并运行 script 时,它不起作用。
网页odds我在追。
我的输出而不是不同的赔率看起来像:
[['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87']]
我怎样才能让赔率发挥作用?
HTML:
<div class="gl-ParticipantOddsOnlyDarker gl-ParticipantOddsOnly gl-Participant_General sl-MarketCouponAdvancedBase_LastChild " >
<span class="gl-ParticipantOddsOnly_Odds" > 2.45 </span>
</div ><span class="gl-ParticipantOddsOnly_Odds">2.45</span>
来自website
【问题讨论】:
-
请分享相关的HTML
-
@DebanjanB 我将 html 添加到问题中。
标签: python selenium xpath web-scraping