What is PhantomJS and what is the usage of it?

0 votes
What is PhantomJS and what is the usage of it?
May 17, 2019 in Selenium by Ojaswini
714 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, 2019 by Anvi
• 14,110 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, 2019 by Abha
• 27,930 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, 2019 in Selenium by Pratibha
• 3,690 points
1,139 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, 2019 in Selenium by Abha
• 27,930 points
222 views
+1 vote
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, 2019 in Selenium by Abha
• 27,930 points
439 views
0 votes
2 answers

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,510 points
3,565 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31 in Selenium by Sri
• 2,970 points
4,570 views
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,890 points
2,615 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 2 in Selenium by Sri
• 2,970 points
2,908 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, 2019 in Selenium by Anvi
• 14,110 points
1,493 views
+1 vote
2 answers