I’m trying to get data from a website but it takes a second to load (JavaScript table) so I get inconsistent results (sometimes more of the webpage sometimes less) depending on the connection speed.
I’m using MATLAB and have the following code:
% DEFINE URL
URL = 'https://www.wunderground.com/history/daily/us/il/chicago/KORD';
jUrl = java.net.URL(URL);
% CONNECTION
conn = jUrl.openConnection()
conn.setRequestProperty{<<needed details here>>};
conn.connect()
% OUTPUT
output = java.io.ByteArrayOutputStream()
output.flush()
% INPUT
ins = conn.getInputStream();
org.apache.commons.io.IOUtils.copy(ins,output);
output.close();
ins.close();
Is there a way to implement a pause to wait for the javascript on the page to fully load?
Thanks.