Steps to install PhantomJS On CentOS7

Steps-to-install-PhantomJS-On-CentOS

The most effective method to Install PhantomJS On CentOS 7.

What is PhantomJS?

PhantomJS is, in the most straightforward of terms, is a headless program that uses a javascript API.

This capacity makes the program exceptionally valuable when utilized for:

Network observing – Monitoring page load times and sending out that data as standard HAR documents. It additionally mechanizes execution investigation utilizing YSlow and Jenkins.

Headless site testing – Running useful tests with the Jasmine, QUnit, Mocha, and WebDriver structures.

Screen catch – Programmatically catching web content, including SVG and Canvas. Make the site screen captures with a thumbnail preview.

Page computerization – Accessing website pages and extricating data utilizing the standard DOM API, or with regular libraries like jQuery.

Essentials

To guarantee PhantomJS introduces and works accurately, you have to check the accompanying bundles are introduced and exceptional on our framework:

glibc
fontconfig
fontconfig-devel
freetype
freetype-devel
wget
bzip2

The most ideal approach to confirm if every single required bundle is introduced by using the “YUM list installed bundles” command. You can check this utilizing the accompanying command:

[root@server ~]# yum list installed

The installed bundles rundown can be quite long, utilizing the “more” or “less” commands channeled after the list command will enable you to look through the list rapidly.

[root@server ~]# yum list introduced | more 
[root@server ~]# yum list introduced | less 

In addition, you can grep for the explicit package in the essential list:

 [root@server ~]# yum list introduced | grep "package name" 

On the off chance that any of the packages are missing, you can utilize this command to install them.

[root@server ~]# sudo yum introduce glibc fontconfig freetype-devel fontconfig-devel wget bzip2 

Check the PhantomJS Install

Initially, you should check the software version. We can achieve this by composing:

[root@server ~]# phantomjs --version 2.1.1

Likewise, you can check the form utilizing the PhantomJS brief. To open the PhantomJS brief, type:

[root@server ~]# phantomjs  

At the new brief, type the “phantom.version” command. The output should resemble this:

[root@server ~]# phantomjs  

phantomjs> phantom.version

{
“major”: 2,
“Minor”: 1,
“patch”: 1

}

Test PhantomJS

To guarantee that everything is functioning as expected, you want to make a short .js content. Now, make a another content record that contains the accompanying lines:

console.log(‘Hello, world!’);
phantom.exit();

Then, save it as helloworld.js and run it:

[root@server ~]# phantomjs helloworld.js  

On the off chance that everything is working effectively, the yield should resemble this:

[root@server ~]# phantomjs helloworld.js 
Hello, world!

As a side note, the Ubuntu establishment is about the equivalent with the exception of we would utilize well-suited get rather than yum.

Hope you have successfully installed PhantomJS. If you need any assistance on this you can Contact Us.

Follow us : Facebook , Twitter

Subscribe to get free blog content to your Inbox