gpt4 book ai didi

python - Selenium Steam 社区市场列表 python

转载 作者:行者123 更新时间:2023-12-01 04:38:42 25 4
gpt4 key购买 nike

我正在尝试编写一个程序,该程序将打开一个 Steam 社区页面,然后读取价格表中的第一个值。之后我会用这个来做一些事情。如果这是任何人的建议,我不想使用 steam api,我想知道如何选择表中的第一个 id,因为它会不断变化,而且我无法定义集合 id,并且尝试按类定位被证明是困难的。

我的代码目前可以打开网页,这不是问题

来自社区市场的商品示例。

<div class="market_listing_right_cell market_listing_their_price">

<span class="market_table_value">
<span class="market_listing_price market_listing_price_with_fee"></span>
<span class="market_listing_price market_listing_price_without_fee"></span>

最佳答案

据我了解,您正在使用this page .

要获取价格列表,请使用 market_listing_row 类迭代 div 元素中包含的结果,并使用 market_listing_their_price 获取元素的文本> 类:

for result in driver.find_elements_by_css_selector("div.market_listing_row"):
price = result.find_element_by_css_selector("div.market_listing_their_price")
print price.text.strip()

这将打印如下价格结果:

Starting at: $0.63
Starting at: $0.27

关于python - Selenium Steam 社区市场列表 python,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31230972/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com