Page 1 of 1

Document instance

Posted: Wed Oct 19, 2022 2:27 pm
by vthourte
Hello! I recently changed my delphi application to use TWVBrowser instead of TWebBrowser, which used Internet explorer engine to work.
This last class had a Document property, whose body was used to get latitudes and longitudes on a Google maps map. Is there any alternative to this property in TWVBrowser? I imagine it's in there somewhere since i can access the document title.
Any help would be appreciated

Re: Document instance

Posted: Wed Oct 19, 2022 3:56 pm
by salvadordf
Hi,

Read this to know more about the DOM access feature request :
https://github.com/MicrosoftEdge/WebView2Feedback/issues/77

For now, you can execute JavaScript or use the DevTools methods to access the DOM.

Re: Document instance

Posted: Wed Oct 19, 2022 7:49 pm
by vthourte
Hi!
Thanks for the quick answer.
I think i could get away with JavaScript, though there's something I'm not quite getting.
I dont need to manipulate the DOM, instead I need to get and element value by its ID.
I can call the JavaScript function but I dont understand where the result im asking is left.
Sorry if my question sounds dumb or low level, I dont have much experience with web development and the way it functions.

Re: Document instance

Posted: Wed Oct 19, 2022 8:21 pm
by salvadordf
You can execute any custom JS code and send the results to Delphi using the functions that you can find in the BrowserHostAppCommunication demo.