I'm not fully sure how to explain this: but I need to execute javascript code on a site via a C# webrequest, and use a GET request on the site with the js code executed.
I need to put the code
function getTitlesAndLinks() {
var arr = [...document.getElementsByTagName('h3')];
var filteredHeadings = [];
var filteredLinks = [];
arr.forEach(x => filteredHeadings.push(x.innerText));
arr.forEach(x => filteredLinks.push(x.baseURI));
var printToScreen = "";
for(let i = 0; i < filteredHeadings.length; i++) {
printToScreen +=
"<div><p>" +
filteredHeadings[i] +
"</p><p><a href=" +
filteredLinks[i] +
">" +
filteredHeadings[i] +
"</p></a></div><br>"
}
return printToScreen;
}
document.body.innerHTML = getTitlesAndLinks();
Into google's search and get the results
Any idea on how I can do this?
For more insight, I am using the Leaf.xNet library for my HTTP requests
I have tried to do this by adding java headers and stuff but I have no idea where to start