WebView exercise

Hello everybody, I’m new to the forum.

I’m grappling with a problem without finding the solution, so I ask you for help.

I want to load a page, then enter my username and password, then press the “log in” button, and then retrieve a data table.

For the first part I managed without problems:
var v = new WebView();
await v.loadURL(“https://www.youbike.cloud/login”);

var Js = document.getElementById('username').value = 'MYUSERNAME'; document.getElementById('password').value = 'MYPASSWORD'; document.getElementById('_submit').click();
await v.evaluateJavaScript(Js);
await v.present();

This script works fine, autologin works so when I present the WebView I see the second page of youbike site where there is a table under a div element with id ‘mappa’ that I want to retrieve.

BUT if I comment await v.present(); and add this other portion of the script:

var Js = console.log(document.getElementById('mappa'));
await v.evaluateJavaScript(Js);

I see in log. This is because after Scriptable automatically clicks button id “_submit”, the second page displays after a while, so I need something to wait that this second page is completely loaded, or to wait that document.getElementByid(“mappa”) is not null before I can access it.

I tried await v.waitForLoad(); without success.

How can I achieve this result?

Thank you in advance for your help.