PhantomJS is a headless browser. It's used to test your applications in background, without launching a browser. Unlike Selenium, which launches the browser and then clicks buttons manually, a headless browser does everything in the background.
This is possible because all that the test framework cares about is the HTML content and not the actual UI.