Solvedphantomjs QXcbConnection: Could not connect to display
✔️Accepted Answer
can confirm export QT_QPA_PLATFORM=offscreen
before selenium scripts work's well.
Other Answers:
The offscreen
platform is a usable workaround for me with the stock Ubuntu package. This works for me:
QT_QPA_PLATFORM=offscreen phantomjs rasterize.js 2i8zaNg04d9B41Zir2kT3J/output.html 2i8zaNg04d9B41Zir2kT3J.png
@3zzy the steps I used are as follows:
wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
bzip2 -d phantomjs-2.1.1-linux-x86_64.tar.bz2
tar -xvf phantomjs-2.1.1-linux-x86_64.tar
cp phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/bin/phantomjs
Does this help your case?
We finally got things working by downloading the binary at https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 and extracting the phantomjs to /usr/bin
Please check your environment variable QT_QPA_PLATFORM
. It must be empty.
phantomjs --version
.2.1.1
Ubuntu 16.04 LTS
Binary - installed it as part of Ubuntu (using apt).
This is very similar to #14240, but I am using the stock version of PhantomJS (with Ubuntu). Below is the output from running the cron job (which calls the script file, to generate a pdf file once a day) ...
Thanks!