PhantomJS screenshots not showing text - phantomjs

I'm using PhantomJS to run some automated tests through Codeception. When I generate a screenshot however the page shows but none of the text does, like the sample below.
Here is the script I use to install phantomjs. I'm using CentOS 7.1
echo "## Install phantomjs dependencies"
sudo yum install freetype-devel fontconfig-devel libicu-devel gcc glib libpng-devel bison sqlite-devel gperf flex libjpeg-devel -y
echo "## Install phantomjs"
cd ~
PHANTOM_JS="phantomjs-2.1.1-linux-x86_64"
wget https://bitbucket.org/ariya/phantomjs/downloads/$PHANTOM_JS.tar.bz2
sudo mv $PHANTOM_JS.tar.bz2 /usr/local/share/
cd /usr/local/share/
sudo tar xvjf $PHANTOM_JS.tar.bz2
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/share/phantomjs
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin/phantomjs
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/bin/phantomjs
sudo rm -fr $PHANTOM_JS.tar.bz2
phantomjs -v
My initial thought was I'm missing a font library but from what I can read on the phantomjs site I should have all the packages.

So it looks like my version of CentOS does not actually have any fonts installed. Adding the following lines to my PhantomJS install script added some fonts to the system and the screenshots worked as expected.
sudo yum install cabextract xorg-x11-font-utils -y
sudo rpm -i https://downloads.sourceforge.net/project/mscorefonts2/rpms/msttcore-fonts-installer-2.6-1.noarch.rpm

If you can't see the text in the screenshots after installing fonts, make sure that you are using the correct user-agent that tells what is the OS that your machine is running on.
E.g:
Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36
- with this one I CAN'T see the text.
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.0 Safari/537.36
- with this one I see the text.
I'm using Linux CentOS.

Related

How do I install NPM on a Chromebook?

I installed NodeJS (via Linux terminal) but it doesn't seem to come bundled with NPM:
:~$ sudo apt-get install -y nodejs
:~$ node -v
:~$ v10.23.1
:~$ npm -v
:~$ -bash: npm: command not found
I have an Acer Chromebook R 13 with an ARM processor.
Installing NodeJs
sudo apt-get install curl gnupg -y
curl -sl https://deb.nodesource.com/setup_13.x | sudo -E bash -
sudo apt-get install -y nodejs
In my case I didn't have the install script for npm, so got it externally
curl -L https://npmjs.org/install.sh | sudo sh
nvm is recommended on the npmjs.com install page, and nvm has installation instructions of using an install script.
Open the Terminal app on Chromebook.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
nvm install node
npm is now ready.
Due to trying to answer in comments i will attempt to give a complete answer here.
You need to first aquire the correct package for your architecture. As you have noted you are using the Acer Chromebook R13. This uses the MediaTek MT8173C processsor which utilizes ARMv8 instruction set.
following these commands should get you up and running.
#first, download the proper package for your architecture
mkdir myNodeJS
cd myNodeJS
wget https://nodejs.org/dist/v14.15.5/node-v14.15.5-linux-arm64.tar.xz
tar -xf node-v14.15.5-linux-arm64.tar.xz
cd node-v14.15.5-linux-arm64
cd bin
sudo cp node /usr/local/bin
cd ..
cd /lib/node_modules/npm/scripts
./install.sh
That should be it, if you have problems, you can resort to the first link that i sent for install instructions

Installing Apache OpenWhisk using docker-compose on Amazon Linux instance gets stuck at "waiting for the Whisk invoker to come up..."

I am trying to install openwhisk for dev mode using docker compose on Amazon Linux EC2 Instance. I am following this link for doing so https://github.com/apache/incubator-openwhisk -> Get Started.
Although, it has worked for me before once, in this installation, I am facing an issue. These are the steps I followed:
sudo yum update -y
sudo yum install -y docker
sudo service docker start
sudo chkconfig docker on
sudo yum install -y python-pip
sudo pip install docker-compose
This step is because open whisk is using sudo for docker-compose, and based on previous steps, sudo docker-compose -v gives a command not found.
sudo cp /usr/local/bin/docker-compose /bin
sudo yum install -y git
cd ~
git clone https://github.com/apache/incubator-openwhisk-devtools.git
cd incubator-openwhisk-devtools/docker-compose
sudo make quick-start
Update: The problem is that the make command gets stuck at the stage where it is waiting for invokers.
I have not made any changes to any source code, nor I did any other steps before this on the instance. It was a freshly created instance.
Am I missing something in OpenWhisk or EC2 or the combination of both? Any help would be great.
Update: I tried the docker-compose method for installing open whisk on Amazon Linux 1, Amazon Linux 2, Ubuntu 16.04 as well as Ubuntu 14.04. On all platforms, it got stuck at sudo make quick-start where it is waiting for invokers.
Update: Instead of using python-pip for docker-compose installation, used the command from docker website as well.
sudo curl -L https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
if docker-compose command is not found it means you didn't install docker-compose correctly.
I don't think you can install docker-compose as a python library using pip
See the instructions here https://docs.docker.com/compose/install/#install-compose
someting like
sudo curl -L https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
Or take a look at https://medium.com/#khandelwal12nidhi/docker-setup-on-aws-ec2-instance-c670ff3d5f1b

Installing libapache2-mod-php7.1

I installed Apache 2.4.27 and PHP 7.1.7 from source, but I don't find a tip about how to install libapache2-mod-php7.1 or the required module.
How can I install libapache2-mod-php7.1 (or similar) to Apache 2 located under /user/local/apache2?
I have to install it on Debian 8.8 Jessie.
Basically it should be installed during installation of PHP:
sudo apt-get install php7.1
...
The following NEW packages will be installed:
libapache2-mod-php7.1 libssl1.0.2 php-common php7.1 php7.1-cli php7.1-common php7.1-json php7.1-opcache php7.1-readline
So first check if it is already installed:
dpkg -l | grep libapache2-mod-php7.1
ii libapache2-mod-php7.1 7.1.7.retag-1+0~20170711133844.5+jessie~1.gbp5284f4 amd64 server-side, HTML-embedded scripting language (Apache 2 module)
In case it is not installed the following command should work fine:
sudo apt-get install libapache2-mod-php7.1
If it will fail check if it is available in repo:
apt-get update
apt-cache search libapache2-mod-php7.1
I used deb.sury.org for php 7.1:
apt-get install apt-transport-https ca-certificates
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ jessie main" > /etc/apt/sources.list.d/php.list
apt-get update

Phalcon install give error on ubuntu [duplicate]

I'm just finished installing Ubuntu 13.10.
I want try Phalcon, and when I build the source (phalcon.so), I have this error :
from /home/fabrice/Downloads/cphalcon/build/32bits/phalcon.c:204:
/usr/include/php5/ext/pcre/php_pcre.h:29:18: fatal error: pcre.h: No such file or directory
#include "pcre.h"
^
compilation terminated.
make: *** [phalcon.lo] Erreur 1
My installation of lamp is :
sudo apt-get install -y apache2 php5 mysql-server libapache2-mod-php5
php5-mysql php5-curl php5-imagick php5-mcrypt php5-memcache
php5-sqlite php5-xdebug php-apc php5-intl php-mongo php5-dev gcc
Can anybody help me ?
The latest version of Phalcon uses PCRE libraries.
You can install them like so:
sudo apt-get install libpcre3-dev
and then try and install Phalcon again
For CentOS you will need to use
sudo yum install pcre-devel
Credits: #xgretsch
For Mac you can use
brew install pcre
Credits #Brandon Romano
For Mac without brew
Go to https://www.pcre.org/ and download latest pcre:,
tar -xzvf pcre-8.42.tar.gz
cd pcre-8.42
./configure --prefix=/usr/local/pcre-8.42
make
make install
ln -s /usr/local/pcre-8.42 /usr/sbin/pcre
ln -s /usr/local/pcre-8.42/include/pcre.h /usr/include/pcre.h
Credits #user1377324
For mac osx maverick you can use
brew install pcre
if it gives you error, you can use
sudo ln -s /opt/local/include/pcre.h /usr/include/
sudo pecl install apc
I have installed pcre via homebrew in Big Sur, so linked as:
sudo ln -s /opt/homebrew/include/pcre2.h /usr/local/include/
To include pcre.h file, search the package archives for the pcre.h file.
To do this I use a command called apt-file (
apt-get install apt-file
and
apt-file update
if you don’t have it installed).
Then search for the pcre package:
apt-file search -x "/pcre.h$"
The -x informs the command that I want to use a regular expression as the pattern. apt-file provided me with three hits:
kannel-dev: /usr/include/kannel/gwlib/pcre.h
libajax6-dev: /usr/include/ajax/pcre.h
libpcre3-dev: /usr/include/pcre.h
The last one is the one I want:
apt-get install libpcre3-dev
This will solve the problem with pcre.h file compilation problem. Hope it will help others, who may come to find an answer to this thread.
For MacOS monterey amd64 (darwin), it is necessary to create a symlink.
First, locate where the pcre.h was installed by Brew:
$ brew list pcre | grep 'pcre\.h$'
/opt/homebrew/Cellar/pcre/8.45/include/pcre.h
Then, gets the directory that GCC is looking for header (.h) files:
$ cpp -v
...
#include <...> search starts here:
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
/Library/Developer/CommandLineTools/usr/include # <---- we are going to use this one
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks (framework directory)
Finally, create a symlink to the pcre.h file, so that GCC will find it in its search path:
ln -s /opt/homebrew/Cellar/pcre/8.45/include/pcre.h \
/Library/Developer/CommandLineTools/usr/include/pcre.h
To test if it worked, we can use the following C code:
#include <stdio.h>
#include <pcre.h>
int main() {
printf("lala popo");
return 0;
}
And run:
gcc test.c -o test
πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰
Using macOS Monterey 12.6 on an M1 Pro MacBook Pro, here are the steps necessary to install outh extension for PHP 8.1 using brew:
brew install pcre
brew install pcre2
sudo ln -s /opt/homebrew/include/pcre.h /usr/local/include/
sudo ln -s /opt/homebrew/include/pcre2.h /usr/local/include/
sudo pecl install oauth

yum search for 'libcli-dev' on Centos 6.4

I'm compiling a 32bit binary (-m32) on Centos6.4 (64 bit). But yum couldn't find 'libcli-dev' for both of i386, i686 or x86. Which repo I should include to get Yum get these packages?
I loaded them manually through 'rpm':
I got them from:
http://pkgs.repoforge.org/libcli/
But I still would like to know the correct repo. Thanks
RepoForge [formerly RPMForge] has it:
http://repoforge.org/use/
$ wget <url>
$ sudo rpm -ivh rpmforge-release-*.rpm
$ sudo yum update