WebView doesn't work

I tried doing webview.loadURL("https://google.com/", new Size(1920, 1080), true);
, but it still can’t find obvious elements which finds in any other browser and in mobile view. :confused:

Sorry for the late reply.

I meant it like this

let webview = new WebView();

let req = new Request("http://httpbin.org/get");
req.headers = {
  "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36",
};
await webview.loadRequest(req)
log(await webview.getHTML())

Apparently the user agent is overridden by the WebView, so that’s not going to work.

Loading the page with the request itself works though. You can then use loadHTML() to load the response string like this:

let webview = new WebView();

let url = "https://google.com";

let req = new Request(url);
req.headers = {
  "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36",
};
let res = await req.loadString();
await webview.loadHTML(res, url);

let dataGets = `
(function() {
var x = document.getElementsByClassName('o3j99');

 completion(x[0].outerHTML);
return;

})();
`

let response = await webview.evaluateJavaScript(dataGets, true);

console.log(response);