我试图从这个网站的表格中获取信息,但我只从第一个“标签”中获取内容。当从选项卡1切换到选项卡2时,我看到url是相同的。 有没有办法获得一个或多个包含此网页中所有选项卡信息的表格
from pandas.io.html import read_html
from selenium import webdriver
today = "2020-02-03"
url = "https://newsweb.oslobors.no/search?category=&issuer=&fromDate=2010-01-01&toDate=2020-02-03&market=&messageTitle="
driver = webdriver.Firefox(executable_path = r'my gecko path')
driver.get(url)
driver.implicitly_wait(100)
table = driver.find_element_by_xpath('/html/body/div[1]/div/main/table')
table_html = table.get_attribute('outerHTML')
tables = read_html(table_html)[0]
print(tables)
我已经用
chrome
浏览器完成了,希望firefox
能给你同样的结果使用无限循环并检查可用的
next
按钮。如果页面上不可用,它将中断循环。而不是使用隐式等待WebDriverWait
()代码: 解决方案1在每页上打印表格
解决方案2将提供包含所有记录的单个数据帧
输出:
相关问题 更多 >
编程相关推荐