Skip to content

Stateful programmatic web browsing, based on Python-Mechanize, which is based on Andy Lester’s Perl module WWW::Mechanize.

License

Notifications You must be signed in to change notification settings

WilliamABradley/Mechanize.NET

Repository files navigation

Mechanize.NET

Stateful programmatic web browsing, based on Python-Mechanize, which is based on Andy Lester’s Perl module WWW::Mechanize.

license AppVeyor

NuGet Package Name Description Version Download Count
Mechanize.NET Stateful programmatic web browsing, based on Python-Mechanize, which is based on Andy Lester’s Perl module WWW::Mechanize. NuGet NuGet
Mechanize.NET.AngleSharp AngleSharp IHtmlParser Extension for Mechanize.NET NuGet NuGet

By default, MechanizeBrowser uses HtmlAgilityPack as the Html Parser. To use other Parsers, such as AngleSharp, change your instantiation to:

using (var browser = new MechanizeBrowser(new AngleSharpParser()))
{
}

Example

Google Search

using (var browser = new MechanizeBrowser())
{
    var page = await browser.NavigateAsync("https://www.google.com/");
    if (page.IsHtml)
    {
        var form = page.Forms["f"];
        var queryfield = form.FindControl<ScalarControl>("q");
        queryfield.Value = "Mechanize.NET";

        var newpage = await form.SubmitForm();
        var contents = newpage.Document;
        // Collect the Results from contents.
    }
}

The Mechanize Family

Language Creators Name
Perl Andy Lester WWW::Mechanize
Python Kovid Goyal Python-Mechanize
Ruby SparkleMotion Mechanize
Java GistLabs Mechanize for Java
C# William Bradley Mechanize.NET

About

Stateful programmatic web browsing, based on Python-Mechanize, which is based on Andy Lester’s Perl module WWW::Mechanize.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published