E
E
egor_spk2015-03-02 02:04:53
.NET
egor_spk, 2015-03-02 02:04:53

How to get the click attributes of an element on a web page in a WPF application?

Hello.
There was a task of writing a C# + WPF + MVVM application for analyzing web pages. Briefly, the algorithm looks like this:
1) The application has a built-in ability to display web pages.
2) The user selects an element on the page. More often these will be links of the form <a href="myhomepage.ru">My home page</a>.
3) The program must intercept this event and determine the source of the event. Then, get the code of the given element, i.e. just <a href="myhomepage.ru">My home page</ a>.
I tried to use the standard WebBrowser, but everything works somehow for a long time and using the Microsoft HTML Object Library has not yet come out to get the correct result.
Looked towards Awesomium, but as far as I understand, for my task I will have to use pieces of javascript code, which is not very attractive.
Could you point me in the right direction.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Doshevsky, 2015-03-02
@MikhailD

I solved a similar problem with the WebView control by adding js code to the page:
And then I intercepted it in C#:

private void WebView_ScriptNotify(object sender, NotifyEventArgs e)
{
        // e.Value - argument
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question