我正在使用氦氣來抓取網頁。
result = start_firefox(
"https://www.medtronic.com/covidien/en-us/products/brain-monitoring/bis-monitoring-system.html",
)
result.find_element_by_class_name("js-open-table-overlay").click()
單擊操作后,我看到了一個表格,我需要抓取表格的內容,但是單擊后如何選擇表格?
uj5u.com熱心網友回復:
您需要使用find_elements_...來獲取所有內容<table>,并使用for-loop 分別處理每個表格,并使用 (nested) -loop 來for獲取表格中的<tr>(row) 和<th>(header),并使用 (nested) for-loop 來獲取<td>(cell)在排隊。而且您必須將元素添加到正確的(嵌套)串列中。
但是此頁面使用正常<table>,并且此表始終為 HTML(不是由 javaScript 添加),因此使用它可以更簡單pandas.read_html()地獲取所有<table>
import pandas as pd
url = "https://www.medtronic.com/covidien/en-us/products/brain-monitoring/bis-monitoring-system.html"
all_tables = pd.read_html(url)
for table in all_tables:
print(table.to_string())
結果
ORDER CODE DESCRIPTION UNIT OF MEASURE QUANTITY
0 186-1014 BIS? Complete 4-Channel Monitoring System Each 1
1 186-0210 BIS? Complete 2-Channel Monitor Each 1
2 186-0224-AMS BIS? LOC 4-Channel Monitor with Patient Interface Cable (PIC-4) Each 1
3 186-0195-AMS BIS? LOC 2-Channel Monitor with Patient Interface Cable Each 1
4 186-0212 BIS? Bilateral Sensor Each 1
DISPLAY BIS? COMPLETE 2-CHANNEL MONITOR BIS? COMPLETE 4-CHANNEL MONITORING SYSTEM
0 Parameters BIS, SQI, EMG, SR, BC, EEG BIS, SQI, EMG, SR, BC, TP, SEF, EEG
1 Trended parameters BIS, SQI, EMG, SR, BC BIS, SQI, EMG, SR, BC, SEF
2 BIS? alarm Upper and lower limit, results in visual and audible alert when out of range Upper and lower limit, results in visual and audible alert when out of range
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/442006.html
上一篇:在Nodejs中用puppeteer抓取資料,結果不同
下一篇:美麗的湯在這個網站上不起作用
