Created
October 10, 2016 09:52
-
-
Save henryjuan/a0944b075c2b779da584f42c0eb0e3ad to your computer and use it in GitHub Desktop.
利用 nightmare 取中銀報價
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Nightmare = require('nightmare'); | |
var nightmare = Nightmare({ show: true }); | |
nightmare | |
.goto('http://www.boc.cn/sourcedb/whpj') | |
.select('html body div.wrapper div.BOC_main div.publish div div#DefaultMain.main form#historysearchform div.invest_t table tbody tr td select#pjname', '2895') | |
.click('html body div.wrapper div.BOC_main div.publish div div#DefaultMain.main form#historysearchform div.invest_t table tbody tr td input.search_btn') | |
.wait(2000) | |
.evaluate(function () { | |
return document.querySelector('table:first-child tr.odd').innerText; | |
}) | |
.end() | |
.then(function (result) { | |
console.log(result) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment