DOM GetelementbyId

105 views
Skip to first unread message

Sai Prasad

unread,
Aug 11, 2016, 5:19:13 AM8/11/16
to CefGlue
Dear Dmitry:

I am using xilium.cefglue in windows forms application, I have a scenario like after the url has been loaded I have to get the element by tag name or by Id can you please suggest me how can I achieve this.

Dmitry Azaraev

unread,
Aug 11, 2016, 9:01:55 AM8/11/16
to CefGlue

Depending from you needs... Easiest and powerful way is just execute javascript. If you not need return value - EvaluateJavaScript functiin can help. If you need ret val - send message to denderer and use CefV8Context.Eval to execute scripts (in renderer process).


On Thu, Aug 11, 2016, 12:19 Sai Prasad <sega.sa...@gmail.com> wrote:
Dear Dmitry:

I am using xilium.cefglue in windows forms application, I have a scenario like after the url has been loaded I have to get the element by tag name or by Id can you please suggest me how can I achieve this.

--
You received this message because you are subscribed to the Google Groups "CefGlue" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cefglue+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sai Prasad

unread,
Aug 11, 2016, 12:59:59 PM8/11/16
to cef...@googlegroups.com

Hi Dmitry,

yes I need to get the return value to the c# code and I need to further process with that .. even I have tried with cefdomvisitor but no luck with that can you please provide code sample link to return the value


To unsubscribe from this group and stop receiving emails from it, send an email to cefglue+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "CefGlue" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cefglue/zogeDk9c-qo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cefglue+unsubscribe@googlegroups.com.

Sai Prasad

unread,
Aug 11, 2016, 1:00:00 PM8/11/16
to cef...@googlegroups.com

Hi Dmitry,

yes I need to get the return value to the c# code and I need to further process with that .. even I have tried with cefdomvisitor but no luck with that can you please provide code sample link to return the value

Dmitry Azaraev

unread,
Aug 12, 2016, 9:29:36 AM8/12/16
to cef...@googlegroups.com

CefDomVisitor has strong limitations and hard to use. Sorry, i no have time now. I'm described how to do it in short. Good starting point is https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md and other wiki articles. It is actually very easy to do.

1. Assign unique request id
2. Send process message to renderer with js
3. In renderer handle message, execute js from message and send reply message to browser process with request id and result
4. Handle reply message in browser process. By using request id you can pass this result to caller. In async/await style code is usually done with TaskCompletionSource while caller await for result.

Look at API and play with it, and choose best suitable way for you.


On Thu, Aug 11, 2016, 20:00 Sai Prasad <sega.sa...@gmail.com> wrote:

Hi Dmitry,

yes I need to get the return value to the c# code and I need to further process with that .. even I have tried with cefdomvisitor but no luck with that can you please provide code sample link to return the value

On 11 Aug 2016 10:27 pm, wrote:

Hi Dmitry,

yes I need to get the return value to the c# code and I need to further process with that .. even I have tried with cefdomvisitor but no luck with that can you please provide code sample link to return the value

On 11 Aug 2016 6:31 pm, "Dmitry Azaraev" <dmitry....@gmail.com> wrote:

Depending from you needs... Easiest and powerful way is just execute javascript. If you not need return value - EvaluateJavaScript functiin can help. If you need ret val - send message to denderer and use CefV8Context.Eval to execute scripts (in renderer process).


On Thu, Aug 11, 2016, 12:19 Sai Prasad <sega.sa...@gmail.com> wrote:
Dear Dmitry:

I am using xilium.cefglue in windows forms application, I have a scenario like after the url has been loaded I have to get the element by tag name or by Id can you please suggest me how can I achieve this.

--
You received this message because you are subscribed to the Google Groups "CefGlue" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cefglue+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "CefGlue" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cefglue/zogeDk9c-qo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cefglue+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "CefGlue" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cefglue+u...@googlegroups.com.

Sai Prasad

unread,
Aug 17, 2016, 8:16:17 AM8/17/16
to CefGlue, dmitry....@gmail.com
Hi Dmitry,

I have tried with javascript integration there I can send value to html but am looking for execute some javascript from c# and read some part of html content to c# code as a string and store that string in to c#, I have tried with different ways and didnt worked out so reverted, please help me to read the some part of html content to c#

Dmitry Azaraev

unread,
Aug 17, 2016, 12:50:20 PM8/17/16
to Sai Prasad, CefGlue
Again, easiest way to do it by executing javascript. Using CEF DOM api is not very efficient, as it looks, while js allow access to native implementations for many tasks including serializing DOM (via inner/outerHTML). While i'm prepare example, can you explain which parts you failed with JS integration?

Sai Prasad

unread,
Aug 17, 2016, 1:04:24 PM8/17/16
to CefGlue
Hi Dmitry,
I have refered the link from previous post which you have suggdsted I tried with register extension , js function binding to window which I failed to get the expected output, please give me some code samples so that it will be helpful to achieve

Sai Prasad

unread,
Aug 22, 2016, 2:14:19 AM8/22/16
to CefGlue
Hi Dmitry,

Any updates on this
Reply all
Reply to author
Forward
0 new messages