• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How to install Phantomjs on Ubuntu

{{postValue.id}}

How to install Phantomjs on Ubuntu

Phantomjs is free and open source Scripted, headless browser used for automation of web page interaction. Phantomjs in licensed under BSD license and enables the automated navigation, screenshots and user behaviour. The browsing environment of phantomjs is very similar to Safari and Google Chrome. This tutorial explains the installation procedure of phantomjs on Ubuntu.

Installation procedure

To start the installation procedure, first update the system repositories of the target system by running the following command.

root@linuxhelp1:~# apt-get update
Hit:1 http://in.archive.ubuntu.com/ubuntu xenial InRelease
Get:2 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Get:3 http://in.archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]       
Get:4 http://in.archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]     
Fetched 306 kB in 4s (72.7 kB/s)                           
Reading package lists... Done

Next install some of the required packages for Phantomjs run the below command to install it.

root@linuxhelp1:~# apt-get install build-essential chrpath libssl-dev libxft-dev libfreetype6-dev libfreetype6 libfontconfig1-dev libfontconfig1 -y
Reading package lists... Done
Building dependency tree      
Reading state information... Done
build-essential is already the newest version (12.1ubuntu2).
build-essential set to manually installed.
The following additional packages will be installed:
  fontconfig-config libexpat1 libexpat1-dev libpng12-dev libpthread-stubs0-dev libssl-doc libssl1.0.0 libx11-dev libx11-doc libxau-dev libxcb1-dev libxdmcp-dev
  libxrender-dev x11proto-core-dev x11proto-input-dev x11proto-kb-dev x11proto-render-dev xorg-sgml-doctools xtrans-dev zlib1g-dev
Suggested packages:
  libxcb-doc
The following NEW packages will be installed:
  chrpath libexpat1-dev libfontconfig1-dev libfreetype6-dev libpng12-dev libpthread-stubs0-dev
.
.
.
Setting up xtrans-dev (1.3.5-1) ...
Setting up libxcb1-dev:amd64 (1.11.1-1ubuntu1) ...
Setting up libx11-dev:amd64 (2:1.6.3-1ubuntu2) ...
Setting up libx11-doc (2:1.6.3-1ubuntu2) ...
Setting up x11proto-render-dev (2:0.11.1-2) ...
Setting up libxrender-dev:amd64 (1:0.9.9-0ubuntu1) ...
Setting up libxft-dev (2.3.2-1) ...
Processing triggers for libc-bin (2.23-0ubuntu3) ...

The required packages has been installed successfully in the target system. Download the package for phantomjs by executing the below command.

root@linuxhelp1:~# wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
--2017-04-06 15:45:36--  https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
Resolving bitbucket.org (bitbucket.org)... 104.192.143.1, 104.192.143.2, 104.192.143.3, ...
Connecting to bitbucket.org (bitbucket.org)|104.192.143.1|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://bbuseruploads.s3.amazonaws.com/fd96ed93-2b32-46a7-9d2b-ecbc0988516a/downloads/396e7977-71fd-4592-8723-495ca4cfa7cc/phantomjs-2.1.1-linux-x86_64.tar.bz2?Signature=hepUPrwrpqp3LOlki5z%2FIlYrHlA%
.
.
.

Once the download process is complete. Extract the package using tar command as shown below.

root@linuxhelp1:~# tar xvjf phantomjs-2.1.1-linux-x86_64.tar.bz2 -C /usr/local/share/
phantomjs-2.1.1-linux-x86_64/
phantomjs-2.1.1-linux-x86_64/examples/
phantomjs-2.1.1-linux-x86_64/examples/colorwheel.js
phantomjs-2.1.1-linux-x86_64/examples/scandir.js
phantomjs-2.1.1-linux-x86_64/examples/page_events.js
phantomjs-2.1.1-linux-x86_64/examples/loadspeed.js
phantomjs-2.1.1-linux-x86_64/examples/injectme.js
phantomjs-2.1.1-linux-x86_64/examples/render_multi_url.js
phantomjs-2.1.1-linux-x86_64/examples/server.js
.
.
.
phantomjs-2.1.1-linux-x86_64/examples/postjson.js
phantomjs-2.1.1-linux-x86_64/examples/run-jasmine2.js
phantomjs-2.1.1-linux-x86_64/examples/run-jasmine.js
phantomjs-2.1.1-linux-x86_64/README.md
phantomjs-2.1.1-linux-x86_64/LICENSE.BSD
phantomjs-2.1.1-linux-x86_64/bin/
phantomjs-2.1.1-linux-x86_64/bin/phantomjs
phantomjs-2.1.1-linux-x86_64/third-party.txt
phantomjs-2.1.1-linux-x86_64/ChangeLog

Now to create softlink for Phantomjs binary file to system bin directory run the following command.

root@linuxhelp1:~# ln -s /usr/local/share/phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin/

The Phantomjs is installed on the target machine. Use the below command to verify it’ s version.

root@linuxhelp1:~# phantomjs --version
2.1.1

To enter into Phantomjs prompt, use the command “ phantomjs” . After entering into prompt the phantom can be used. To check about Phantomjs version run the following command.

root@linuxhelp1:~# phantomjs
phantomjs>  phantom.version
{
   " major" : 2,
   " minor" : 1,
   " patch" : 1
}

Wasn' t that any easy installation? Phantomjs is a common tool used to run browser based unit tests in headless system like continous integration environment.

Tags:
isaac
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

What are its necessary dependent packages for Phantomjs?

A

These are the required dependencies "build-essential chrpath libssl-dev libxft-dev libfreetype6-dev libfreetype6 libfontconfig1-dev libfontconfig1" for Phantomjs.

Q

what was Phantomjs's current release?

A

You can check them in "http://phantomjs.org/releases.html" for Phantomjs

Q

What is the command to enter into the phantomjs prompt?

A

To enter into the phantomjs prompt simply type "phantomjs"

Q

What is Phantomjs?

A

Phantomjs is free and open source Scripted, headless browser used for automation of web page interaction. Phantomjs in licensed under BSD license and enables the automated navigation, screenshots and user behaviour. The browsing environment of phantomjs is very similar to Safari and Google Chrome.

Q

What is PhantomJS driver?

A

HTMLUnitDriver & PhantomJS for Selenium Headless Testing. Selenium Web driver is a web automation tool which enables you to run the tests against different browsers.

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Lucas ?
Various options in Top command

Am using Top command only to view the load average, what are the various options in Top command..??

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.