Selenium Beginner 14 – How to use PhantomJS (Headless Browser)


Recommended – How Selenium interacts with PhantomJS

Today we will learn :

1. How to download PhantomJS
2. How to add in selenium project
3. How to run selenium test on PhantomJS

How to download PhantomJS
Step 1
Download phantomJS for your OS

Step 2 (optional)
Download PhantomJS Driver
Not Required with latest PhantomJS
(The latest release of PhatomJS has Ghost Driver integrated and there is no need to install it separately.)

How to run Selenium Test on PhantomJS
Step 1
Set system property – phantomjs.binary.path

System.setProperty(“phantomjs.binary.path”, “location of phantomjs exe”);

Step 2
Create object for PhantomJSDriver class

WebDriver driver = new PhantomJSDriver();

Step 3
Create and Run the Test

Selenium YouTube Playlist

Send me your comments and feedback

%d bloggers like this: