how to use DomVisitor

User avatar
Posts: 2412
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain

Re: how to use DomVisitor

Post by salvadordf » Tue Jun 30, 2020 8:02 am

aneal wrote:
Mon Jun 29, 2020 11:06 pm
It is good news that this code now enables me to GET the value of an input box - thanks!
However when it comes to the SET part of my requirements, the news is not so good. Neither of these work:
aDocument.GetElementById('keywords').SetValue("why is this function here if it is broken?");
The CEF project maintainer is the best person to answer that question but I guess it's there waiting for a "pull request" that fixes it.
aneal wrote:
Mon Jun 29, 2020 11:06 pm
document.getElementById("keywords").value = "this works in chrome developer console but not in CEF";
I just tried that on the DOMVisitor and the MiniBrowser demos with the latest CEF4Delphi version and it works. I just updated the DOMVisitor demo with a context menu option that executes some JS code to set the input element value.
aneal wrote:
Mon Jun 29, 2020 11:06 pm
When looking into this a bit more it appears that this is because the CEF DOM is read-only
Is that correct? The last post on the thread linked above suggested modifying the CEF library to access private WebKit::WebNode member named node_ for the purpose of doing this? Have you any experience of doing this or other (easier?) suggestions on how to set a input box value through JS?

The final part of my demo is to automate a button click. Can you walk me through an example of executing JS to achieve this please?

All the best from Australia
You should be able to click a button using JavaScript by calling the click() method.
Read this for an alternative way to automate clicks :

Post Reply