I wanted to get the real time update of an value displayed on a website Website: http://www.aastocks.com/en/stocks/market/bmpfutures.aspx Target html element id: font26 bold cls ff-arial
and i have been using phantomjs code as the following
var page = require('webpage').create();
page.open('http://www.aastocks.com/en/stocks/market/bmpfutures.aspx', function(status) {
var last_value = -1
setInterval(function() {
var value = page.evaluate(function() {
return document.getElementsByClassName('font26 bold cls ff-arial')[0].innerText
})
if (value != last_value) {
console.log("Value as been updated to " + value)
last_value = value
}
}, 1000)
// phantom.exit()
})
The problem is when the code is first run, it is able to get the value, but after that, the value is cached and not be able to update.
from Phantomjs unable to get refreshed content from HTML website by aspx

No comments:
Post a Comment