The easiest way of installing PhantomJS is by using a NuGet Package Manager.
In your project, right click "References", and click on "Manage NuGet Packages" as shown:
Then, type "PhantomJS" to the search bar, select it and install it as shown below.
Here's a list of other recommended packages:
Now, add these references at the beginning:
using OpenQA.Selenium;
using OpenQA.Selenium.PhantomJS;
Now you can test it with a simple program like this [C#]:
using (var driver = new PhantomJSDriver())
{
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);
}
}