What is PhantomJS and what is the usage of it?

0 votes
What is PhantomJS and what is the usage of it?
May 17 in Selenium by Ojaswini
118 views

2 answers to this question.

0 votes

Hi Ojaswini, PhantomJS is a headless browser with JavaScript API. It is an optimal solution for Headless Website Testing, access and manipulate webpages & comes with the standard DOM API. In order to use PhantomJS with Seleniun, one has to use GhostDriver. GhostDriver is a implementation of Webdriver Wire protocol in simple JS for PhantomJS. The latest release of PhatomJS has integrated GhostDriver so there is no need to separately install it.

Some of the usage of PhantomJS are:

  • Headless Testing
  • Screen Capture
  • Page Automation
  • Network Monitoring
  • To render dashboard screenshots for their users
  • To run Unit tests on command line
  • To generate employee handbooks from HTML to PDF
  • Combined with QUnit for the test suite
answered May 17 by Anvi
• 13,960 points
0 votes

@Ojaswini, Phantomjs is used for automating webpage interactions. It's discontinued Headless browser which provides a Javascript API enabling automated navigation, screenshots, user behavior and assertions.It is a common tool used to run browser-based unit tests in headless system. You can use phantomJs for capturing screenshot this way:

var webpage = require('webpage').create();
webpage.open('http://google.com/', function() {
webpage.render('screenshot.pdf');
phantom.exit();
});
answered Aug 1 by Abha
• 27,180 points

Related Questions In Selenium

0 votes
1 answer

What is Xpath and what are the types of it in Selenium Webdriver?

Hi Piyush, XPath is defined as XML path. It is ...READ MORE

answered May 8 in Selenium by Pratibha
• 3,680 points
218 views
0 votes
1 answer

What is a Selenium framework and what are the benefits of it?

Hi Disha, Selenium framework is a code structure ...READ MORE

answered May 13 in Selenium by Abha
• 27,180 points
86 views
0 votes
2 answers
0 votes
1 answer

What are locators in Selenium and what are the different types of it?

Hi Divya, in Selenium Locators define an ...READ MORE

answered May 7 in Selenium by Abha
• 27,180 points
123 views
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,110 points
974 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
1,130 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
870 views
0 votes
1 answer

What is JUnit and what are the features of it?

Hey Irfaan, JUnit is an open source ...READ MORE

answered Jun 11 in Selenium by Anvi
• 13,960 points
124 views
0 votes
1 answer

What is the difference between findElement and findElements in Selenium Webdriver?

Hi Nilaabh, Selenium Webdriver uses findElement and ...READ MORE

answered May 8 in Selenium by Anvi
• 13,960 points
589 views