How to click a button in js

I tried all the classes and id, there is no click. Help with advice on how to click a button using js commands

document.getElementById(“infoIcon”).click();

document.getElementById(“fileSelector”).click();

document.getElementsByClassName(“blue main”)[0].click();


https://www.virustotal.com/gui/home/upload

You cannot directly access Shadow DOM Elements.
Try this:

document.querySelector('home-view').shadowRoot.querySelector('vt-ui-main-upload-form').shadowRoot.querySelector('#infoIcon').click();
2 Likes

Thank you. I’ll try tomorrow, I’m not at the computer now

did not help…

1 Like

If you are trying to do it in webview then it may not be possible as input element always require manual user action ( such as button click ). it cannot be done via js

You can try it in chrome dev console. js code works

1 Like

sorry … I wanted to create a file scanner application …

1 Like