Page 1 of 1

Problem with execute JavaScript

Posted: Wed Jul 27, 2022 5:35 pm
by gresaggr
Hello.
On my work computer runs fine. On other computers, the click does not work.
Test on Cef 102/97 versions. Windows 10/7

Code: Select all

 codeStr :='var aTags = document.getElementsByTagName("span"); var searchText = "Main menu";var found; for (var i = 0; i < aTags.length; i++){if (aTags[i].textContent == searchText) {found = aTags[i];break;}} found.click();';
 ChromiumWindow1.ChromiumBrowser.Browser.Mainframe.ExecuteJavaScript(codeStr, 'about:blank', 0);

Re: Problem with execute JavaScript

Posted: Wed Jul 27, 2022 7:51 pm
by salvadordf
Open the Console tab in the DevTools to see the JavaScript error.

Chromium updates, fixes or deprecates some JavaScript features in every release. The best way to debug these errors is using the console.

Re: Problem with execute JavaScript

Posted: Thu Jul 28, 2022 3:53 pm
by gresaggr
Try to checking.
Thanks!

Re: Problem with execute JavaScript

Posted: Mon Nov 14, 2022 1:07 pm
by gresaggr
Hello.
On console log error: "File chooser dialog can only be shown with a user activation"
Is it possible to activate dialog for open file?

Re: Problem with execute JavaScript

Posted: Mon Nov 14, 2022 2:05 pm
by salvadordf
If you own that web page there seems to be workarounds :
https://codedocu.com/File-chooser-dialog-can-only-be-shown-with-a-user-activation?2821

Search "File chooser dialog can only be shown with a user activation" (with quotes) in Google to see more workarounds.

If you don't control the web page then I would use a browser in OSR mode and then simulate mouse movements and clicks.

Re: Problem with execute JavaScript

Posted: Mon Nov 14, 2022 5:58 pm
by gresaggr
Thank you!