How to use WebView.runJavaScript

Dear advanced users and developers,

Could anyone help me with WebView.runJavaScript?

I would like to control two buttons on the following web page:
https://www.window-swap.com/window.
The buttons which I want to control by using SC code is

  • button with the label “open a new window somewhere in the world”
    ← The ID of this button is “btn-window” in the HTML document above.
  • mute and unmute button
    ← The class of this button is “volumeWrapper” in the HTML document.

The reason why I want to control the buttons is that the WebView in SC does not automatically play the sound on that web page. I can hear a short sound shortly after evaluating the following code block. WebView tries to play it, but it fails. To listen to the sound, I should click the button “open a new window somewhere in the world”.

If I remember correctly, WebView in SC is from Qt, and the core engine is from Chromium.
Thus, I tried to open the site in Chromium under Catalina, but it fails to play video and sound.
The current state of WebView in Qt might be different from Chromium.

Currently, my code block is as follows:

(
var addr, nCol, nRow, scrW, scrH, view, aRow, rows, views;
addr = "https://www.window-swap.com/window";
nCol = 3;
nRow = 4;
scrW = Window.screenBounds.width;
scrH = Window.screenBounds.height;
view = {
WebView()
.url_(addr)
//.runJavaScript("window.onload=function(){document.getElementById("++"btn-window".quote++").click();};")
//.runJavaScript("$(document).ready(function(){$("++".volumeWrapper".quote++").click();}")
};
aRow = { view ! nCol };
rows = aRow ! nRow;
views = Window(bounds:Window.screenBounds.width@Window.screenBounds.height);
views.layout = VLayout(*rows.collect { |x| HLayout(*x) });
views.front;
)

When evaluating the code, including the commented two lines, SC returns the following error:

ERROR: Primitive '_QObject_InvokeMethod' failed.

How could be the JavaScript correctly included in the code block above?

Thanks in advance, and keep safe from COVID-19!

Warm regards,
prko