tags:

views:

71

answers:

1

I am using GeckoFX version 1.9.1.0 with C#.NET. I have a placed a GeckoWebBrowser Component (geckoWebBrowser1) and a Button (button1) in a form and have navigated the browser to a page. Some text in the page can be selected. This text is composed of one or more DOM elements. When button1 is clicked, I want to retrieve the DOM elements that compose the selected text in the page and give an id to one of those elements and save add these ids to a list (in C# space). How can I do this?

A: 

geckoWebBrowser.Window.Selection is an accessor for a GeckoSelection object which contains everything you need. You can get the nodes & offset where selection starts and ends, or you can get a range of all elements spanned by the selection.

vene