-
-
Save CarterTsai/10f569e1e683b0f730d4aff13f1878d1 to your computer and use it in GitHub Desktop.
taigo 取得Yahoo熱門股票並且搜尋
This file contains 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
const { closeBrowser, openBrowser, goto, write, click, $, into} = require('taiko'); | |
(async () => { | |
try { | |
await openBrowser(); | |
await goto("https://tw.stock.yahoo.com/"); | |
// 取得熱門個股第一個股票編號, 並且搜尋 | |
var hotStockNumber = await evaluate($('#ystkhotb th a > span'), (elem) => {return elem.innerText}); | |
await write(hotStockNumber, into($("#stock_id"))); | |
await press('Enter'); | |
} catch (error) { | |
console.error(error); | |
} finally { | |
closeBrowser(); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment