selenium-webdriver Headless Browsers SimpleBrowser [C#]


Example

SimpleBrowser is a lightweight WebDriver without JavaScript support.

It is considerably faster than an aforementioned PhantomJS, however when it comes to functionality, it is limited to simple tasks with no fancy features.

Firstly, you will need to download the SimpleBrowser.WebDriver package and then put this code at the beginning:

using OpenQA.Selenium;
using SimpleBrowser.WebDriver;

Now, here is a short example on how to use it:

using (var driver = new SimpleBrowserDriver())
{
    driver.Navigate().GoToUrl("http://stackoverflow.com/");

    var questions = driver.FindElements(By.ClassName("question-hyperlink"));

    foreach (var question in questions)
    {
        // This will display every question header on StackOverflow homepage.
        Console.WriteLine(question.Text);
    }
}