Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.

Problem with execute JavaScript

Post Reply
gresaggr
Posts: 22
Joined: Mon Mar 04, 2019 12:41 pm

Problem with execute JavaScript

Post 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);
User avatar
salvadordf
Posts: 4056
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Problem with execute JavaScript

Post 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.
gresaggr
Posts: 22
Joined: Mon Mar 04, 2019 12:41 pm

Re: Problem with execute JavaScript

Post by gresaggr »

Try to checking.
Thanks!
gresaggr
Posts: 22
Joined: Mon Mar 04, 2019 12:41 pm

Re: Problem with execute JavaScript

Post 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?
User avatar
salvadordf
Posts: 4056
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Problem with execute JavaScript

Post 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.
gresaggr
Posts: 22
Joined: Mon Mar 04, 2019 12:41 pm

Re: Problem with execute JavaScript

Post by gresaggr »

Thank you!
Post Reply