我正在尝试从表中提取href链接。运行代码后,我仅从表的第一行收到链接。为什么只检查第一行?我做错了什么? 下面的代码:
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
import requests
import select
import pandas as pd
from bs4 import BeautifulSoup
browser = webdriver.Firefox()
browser.maximize_window()
browser.get('http://licytacje.komornik.pl/Notice/Search')
browser.find_element_by_xpath("//select[@name='Type']/option[text()='Nieruchomość']").click()
browser.find_element_by_class_name('button_next_active').click()
soup = BeautifulSoup(browser.page_source, "lxml")
for table in soup.findAll('table', {'class': 'wMax'}):
for tr in table.findAll('tr'):
for a in tr.findAll('a'):
print(a['href'])
输出为:
/Notice/Search?sortOrder=DataLicytacji
/Notice/Search?sortOrder=Kategoria
/Notice/Search?sortOrder=Nazwa
/Notice/Search?sortOrder=Miasto
/Notice/Search?sortOrder=Wojew%C3%B3dztwo
/Notice/Search?sortOrder=Cena
仅是表标题行中的链接。和其他人在一起吗?