セレンを含む表のcompany names, code, industry, sector, mkt cap, etc
のリストについては、このwebsiteを削り取ろうとしています。私はそれに新たなんだと、以下のコードを書いた:しかしSeleniumによるWebスクラブ
path_to_chromedriver = r'C:\Documents\chromedriver'
browser = webdriver.Chrome(executable_path=path_to_chromedriver)
url = r'http://sgx.com/wps/portal/sgxweb/home/company_disclosure/stockfacts'
browser.get(url)
time.sleep(15)
output = browser.page_source
print(output)
を、私は下のタグを取得することができるんだけど、その中のデータ..
<div class="table-wrapper results-display">
<table>
<thead>
<tr></tr>
</thead>
<tbody></tbody>
</table>
</div>
<div class="pager results-display"></div>
私が以前持っていませんBS4もそれを掻き取ろうとしましたが失敗しました。どんな助けでも大歓迎です。
iframeに切り替える際にエラーが発生しましたが、修正されました。 – alecxe
これは私に私が探している結果を与える!あなたが気にしないなら、書いたコードにもう少しコメントを追加できますか?私はそれからもっと学ぶことができるように?特に 'iframe'部分とそれに切り替えることについて? –
@ jakewong私は以下のドキュメントページを参照してください。http://selenium-python.readthedocs.org/navigating.html?highlight=frame#moving-between-windows-and-framesとhttp:// selenium- python.readthedocs.org/waits.html。物事をクリアする必要があります。ありがとう。 – alecxe