Groza
(95)
February 9, 2022, 3:20pm
#1
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
HritikR
(🧩)
February 9, 2022, 6:24pm
#3
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
Groza
(95)
February 9, 2022, 7:09pm
#4
Thank you. I’ll try tomorrow, I’m not at the computer now
HritikR
(🧩)
February 10, 2022, 8:13am
#6
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
Groza
(95)
February 10, 2022, 8:16am
#7
HritikR:
Если вы пытаетесь сделать это в webview, это может оказаться невозможным, так как элемент ввода всегда требует действий пользователя вручную ( например, нажатия кнопки ). это невозможно сделать с помощью js
sorry … I wanted to create a file scanner application …
1 Like