首页 > 解决方案 > 检查一个按钮是否被 Beautifulsoup 禁用?

问题描述

有没有办法检查一个按钮是否被漂亮的汤禁用。我正在尝试抓取 Airbnb 页面,我想检查是否有下一页。我试过了 :

def findNextPage(soupPage):
''' Finds the next page with listings if it exists '''
if not(soupPage.find("div", {"class": "_jro6t0"}).find("button", {"class": "_za9j7e"}, attrs={"disabled"})):
    return "https://airbnb.com" + soupPage.find("div", {"class": "_jro6t0"}).find("a")["href"]
else:
    return "no next page"

标签: beautifulsouppython-beautifultable

解决方案


推荐阅读