Cef Browser Wpf explore the dom, find elements and change values
Asked Answered
T

1

5

Further to a post (CefSharp load a page with browser login). I implemented the IRequestHandler interface and the different methods, particularly the GetAuthCredentials where I show a dialog and recover user and password and passing it to the event handler. Now I want to access to the dom where I get several frameset with differents frames and I'm interested in one frame which I know the name Atribute. Inside this frame I need to get list of different type of input , select etc... In my app I have a button which I use to set values of the different elements depending if they are present on the displayed page. PROBLEM is I don't see any way of getting the document, the frames collection etc....

Temper answered 15/4, 2015 at 19:8 Comment(0)
D
7

CefSharp doesn't expose the underlying DOM, and is unlikely to see http://magpcss.org/ceforum/viewtopic.php?f=6&t=10652&p=19533#p16750

Your best bet is to use EvaluateScriptAsync and a combination of Javascript Binding

https://github.com/cefsharp/CefSharp/wiki/Frequently-asked-questions#2-how-do-you-call-a-javascript-method-that-return-a-result https://github.com/cefsharp/CefSharp/wiki/Frequently-asked-questions#3-how-do-you-expose-a-net-class-to-javascript

If you absolutely must have DOM access and cannot invent your way to a solution then CefGlue might be a better choice for you. (I should point out that the DOM can only be accesses in the Render process, and as such calls needed to be passed to the Browser process though IPC, so it isn't a trivial task).

Decosta answered 15/4, 2015 at 23:32 Comment(1)
Ok, I understand better the philosophy of the browser, which is ... a browser and not necessarily what I need and what I would yould like to have in such a component. I will experiment with Js script. ThanksTemper

© 2022 - 2024 — McMap. All rights reserved.