Python 尝试在pythin中使用selenium刮去etf.com

Python 尝试在pythin中使用selenium刮去etf.com,python,html,selenium,Python,Html,Selenium,我正努力在页面上找一张桌子> 我用python编写了代码 - 我无法从解析的内容中获取任何内容,因为我无法获取任何与表相关的标记。如何获取该表?rowText不是标记名。您需要编写一个有效的定位器来抓取行文本 代码: driver.get("https://www.etf.com/KJUL") driver.execute_script("window.scrollTo(0, 1000)") KJUL_list = driver.find_element

我正努力在页面上找一张桌子>

我用python编写了代码

-


我无法从解析的内容中获取任何内容,因为我无法获取任何与表相关的标记。如何获取该表?

rowText不是标记名。您需要编写一个有效的定位器来抓取行文本

代码:

driver.get("https://www.etf.com/KJUL")
driver.execute_script("window.scrollTo(0, 1000)")
KJUL_list = driver.find_elements(By.CSS_SELECTOR, "section.generalDataBox div.rowtext")
for kjul in KJUL_list:
    print(kjul.text)
Issuer
Innovator
Inception Date
07/01/20
Legal Structure
Open-Ended Fund
Expense Ratio
0.79%
Assets Under Management
$17.25M
Average Daily $ Volume
$182.82K
Average Spread (%)
0.23%
Competing ETFs
KJAN, KAPR, KOCT
Fund Home Page
Weighted Average Market Cap
--
Price / Earnings Ratio
--
Price / Book Ratio
--
Distribution Yield
--
Next Ex-Dividend Date
N/A
Number of Holdings
--
Index Tracked
No Underlying Index
Index Weighting Methodology
Fixed
Index Selection Methodology
Fixed
Segment Benchmark
MSCI USA Small Cap Index
Expense Ratio
0.79%
Median Tracking Difference (12 Mo)
--
Max. Upside Deviation (12 Mo)
--
Max. Downside Deviation (12 Mo)
--
Max LT/ST Capital Gains Rate
20.00% / 39.60%
Capital Gains Distributions (3 Year)
--
Tax on Distributions
Qualified dividends
Distributes K1
No
Legal Structure
Open-Ended Fund
OTC Derivative Use
Yes
Securities Lending Active
No
Securities Lending Split (Fund/Issuer)
No Policy
ETN Counterparty
N/A
ETN Counterparty Risk
N/A
Fund Closure Risk
High
Portfolio Disclosure
Daily
Avg. Daily Share Volume
6,924
Average Daily $ Volume
$182.82K
Median Daily Share Volume
1,125
Median Daily Volume ($)
$29.66K
Average Spread (%)
0.23%
Average Spread ($)
$0.06
Median Premium / Discount (12 Mo)
-0.05%
Max. Premium / Discount (12 Mo)
0.93% / -0.85%
Impediment to Creations
None
Market Hours Overlap
100.00%
Creation Unit Size (Shares)
25,000
Creation Unit/Day (45 Day Average)
0.04
Creation Unit Cost (%)
0.04%
Underlying Volume / Unit
--
Open Interest on ETF Options
0
Net Asset Value (Yesterday)
$26.47
ETF.com Implied Liquidity
N/A
Goodness of Fit (R2)
0.45
Beta
0.29
Up Beta
0.27
Down Beta
0.29
Downside Standard Deviation
1.05%
Segment Benchmark
MSCI USA Small Cap Index
KJUL Number of Holdings
--
Benchmark Constituents
--
Shared Holdings
--
Shared Holdings Weight
--
O/p:

driver.get("https://www.etf.com/KJUL")
driver.execute_script("window.scrollTo(0, 1000)")
KJUL_list = driver.find_elements(By.CSS_SELECTOR, "section.generalDataBox div.rowtext")
for kjul in KJUL_list:
    print(kjul.text)
Issuer
Innovator
Inception Date
07/01/20
Legal Structure
Open-Ended Fund
Expense Ratio
0.79%
Assets Under Management
$17.25M
Average Daily $ Volume
$182.82K
Average Spread (%)
0.23%
Competing ETFs
KJAN, KAPR, KOCT
Fund Home Page
Weighted Average Market Cap
--
Price / Earnings Ratio
--
Price / Book Ratio
--
Distribution Yield
--
Next Ex-Dividend Date
N/A
Number of Holdings
--
Index Tracked
No Underlying Index
Index Weighting Methodology
Fixed
Index Selection Methodology
Fixed
Segment Benchmark
MSCI USA Small Cap Index
Expense Ratio
0.79%
Median Tracking Difference (12 Mo)
--
Max. Upside Deviation (12 Mo)
--
Max. Downside Deviation (12 Mo)
--
Max LT/ST Capital Gains Rate
20.00% / 39.60%
Capital Gains Distributions (3 Year)
--
Tax on Distributions
Qualified dividends
Distributes K1
No
Legal Structure
Open-Ended Fund
OTC Derivative Use
Yes
Securities Lending Active
No
Securities Lending Split (Fund/Issuer)
No Policy
ETN Counterparty
N/A
ETN Counterparty Risk
N/A
Fund Closure Risk
High
Portfolio Disclosure
Daily
Avg. Daily Share Volume
6,924
Average Daily $ Volume
$182.82K
Median Daily Share Volume
1,125
Median Daily Volume ($)
$29.66K
Average Spread (%)
0.23%
Average Spread ($)
$0.06
Median Premium / Discount (12 Mo)
-0.05%
Max. Premium / Discount (12 Mo)
0.93% / -0.85%
Impediment to Creations
None
Market Hours Overlap
100.00%
Creation Unit Size (Shares)
25,000
Creation Unit/Day (45 Day Average)
0.04
Creation Unit Cost (%)
0.04%
Underlying Volume / Unit
--
Open Interest on ETF Options
0
Net Asset Value (Yesterday)
$26.47
ETF.com Implied Liquidity
N/A
Goodness of Fit (R2)
0.45
Beta
0.29
Up Beta
0.27
Down Beta
0.29
Downside Standard Deviation
1.05%
Segment Benchmark
MSCI USA Small Cap Index
KJUL Number of Holdings
--
Benchmark Constituents
--
Shared Holdings
--
Shared Holdings Weight
--

目标页面严重依赖JavaScript来填充其内容,包括您试图针对的内容。BeautifulSoup是一个HTML解析器,不计算JavaScript。检查
r
的内容,这将确认这一点。使用像Selenium或Puppeter这样的浏览器控制实用程序,它将像您自己的浏览器一样评估页面上的JavaScript。您到底想要哪个表?如图所示的@baduker KJUL摘要表的副本