I have an Electron application that relies on UI automation to play, pause, and skip from global-shortcut. On the website, I can use the jQuery .click()
function and programmatically click on these elements. However, when the same site is embedded in Electron, the DOM changes - is there any way to click on specific elements from a webview in Electron?
Here's what Electron shows in source:
<body style="overflow:hidden;">
<webview id="player" preload="./preload.js" src=" style="position:absolute;width:100%; height:100%" disablewebsecurity="" tabindex="-1"></webview>
<script>
</script>
</body>
I have an Electron application that relies on UI automation to play, pause, and skip from global-shortcut. On the website, I can use the jQuery .click()
function and programmatically click on these elements. However, when the same site is embedded in Electron, the DOM changes - is there any way to click on specific elements from a webview in Electron?
Here's what Electron shows in source:
<body style="overflow:hidden;">
<webview id="player" preload="./preload.js" src="https://play.google. style="position:absolute;width:100%; height:100%" disablewebsecurity="" tabindex="-1"></webview>
<script>
</script>
</body>
You can use jQuery. However, I urge you to move away from it and start realizing how powerful and similar vanilla JS, can be, making a stronger, lighter web app.
You can do this:
document.getElementById('player').click();
Keep in mind that anything you can do in a browser, you can also do in Electron!
On the website, I can use the jQuery .click() function
With electron you can also use jQuery exactly the same way.