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
2,150 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,150 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
• 28,140 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 9, 2019 in Selenium by Pratibha
• 3,690 points
5,372 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
• 28,140 points
1,116 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
• 28,140 points
2,661 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,500 points
13,673 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

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

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,142 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,910 points
7,221 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 3, 2020 in Selenium by Sri
• 3,190 points
7,874 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 12, 2019 in Selenium by Anvi
• 14,150 points
12,450 views
+1 vote
2 answers

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

FindElement Command -This method locates for the ...READ MORE

answered Feb 11, 2020 in Selenium by anonymous
8,368 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP