I want to access a web page through javascript using 'XMLHttpRequest', grab the output and retrieve the table information from the output using 'getElementbyID' or 'getElementsbyName' methods. I could get to the output but the following code but retrieval of the table info gives an error.
var webPage = 'xx';
var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
var reqWebPage = new XMLHttpRequest();
reqWebPage.open('GET', webPage, false);
reqWebPage.send();
var responseHTTP = reqWebPage.responseText;
var tableMain = responseHTTP.getElementbyID('main-table');
console.log tableMain
Error:TypeError: responseHTTP.getElementsbyName is not a function. Is there a way to get around this? I am running this javascript on node and not the browser.