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

左心房为你撑大大i 提交于 2019-12-07 11:45:13

问题


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....


回答1:


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).



来源:https://stackoverflow.com/questions/29658730/cef-browser-wpf-explore-the-dom-find-elements-and-change-values

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!