我想從ebay等網站收集信息(名稱)並將其附加到列表中。但我有一個問題。 我的代碼:如何從非標準類中收集信息。 (Selenium,Python)
for a in driver.find_elements_by_id("scroll"):
name = a.find_element(By.CLASS_NAME(".market-name.market-link")).getText()
mylist.append(name)
print(mylist)
問題:
name = a.find_element(By.CLASS_NAME(".market-name.market-link")).getText() TypeError: 'str' object is not callable
的哪些錯誤?
HTML代碼(我已經刪除了不必要的東西,像picters等):
<div class="featured-item col-sxs-12 col-xs-6 col-sm-6 col-md-4 col-lg-3 center-block app_730_2 item_17511241 has-wear scanned">
<div>
<a class="market-name market-link" href="=shop_view_item&item=17511241">
Happy
</a>
<div class="item-amount" onclick="showGraphFromId(17511241)">
$0.04
</div>
<button class="btn btn-orange" type="button" onclick="addToCart(17511241, 730, 4)">
Add to Cart
</button>
</div>
</div>
的[收集從具有同文類(硒,Python)的許多元素的信息(可能的複製https://stackoverflow.com/questions/45377825/collect-information-from-many-elements-with-identic -class-selenium-python) – DebanjanB