Search code examples
c#getelementbyid

C# GetElementById missing library


I have a problem with a GetElementById function.
I was looking for tutorial "how to make auto login" aplication and I noticed everyone is getting submission while typing .Get... (screen 1). That's how it look in my aplication (screen 2).
When I try use full function it gets this message (screen 3).
I think there can be problem with missing library or something like that. Screen 1Screen 2Screen 3


Solution

  • You'll need to add a reference to mshtml:

    using mshtml;
    

    Then in your event handler:

    private void Button_Click(object sender, RoutedEventArgs e)
    {
        HTMLDocument document = (HTMLDocument)WebBrowser1.Document;
        IHTMLElement element = document.getElementById("email");
    }