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