Apr 3, 2013

How to setup a completely headless browser with Flash support on your linux server

Environment setup

PhantomJS is a beautufil product to launch a headless web browser or your linux server. This can be used to automate a large amounts of tasks which can't be processed with raw curl.

So we have CentOS release 5.7 (Final), 32bit, and need to get completely loaded websites with Flash support. PhantomJS isn't supported Flash plugin since 1.5.0, so we need to use 1.4.1 version. All components can be installed via these guides: rhythmicalmedia.com/?p=146 and code.google.com/p/phantomjs/wiki/XvfbSetup. All should be OK (maybe except the GIT insallation - but phantomjs-1.4.1 is in source code, so no actual usage of GIT).

To start Xvfb you need to add these strings to /etc/init.d/Xvfb

# chkconfig: 345 99 50
# description: Simple graphical server

To make chkconfig work with it. You may need xfvb-run script, one can be obtained from here www.minecraftwiki.net/wiki/Programs_and_Editors/Tectonicus/VPS.

Flash plugin installation routine

rpm -ivh http://linuxdownload.adobe.com/adobe-release/adobe-release-i386-1.0-1.noarch.rpm
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux
yum check-update
yum -y install flash-plugin nspluginwrapper

Command line must contain option --load-plugins=yes - so the correct ones will be

export LIBXCB_ALLOW_SLOPPY_LOCK=1;DISPLAY=:0 ./phantomjs --load-plugins=yes ../examples/rasterize.js URL SCREENSHOT_FILE


export LIBXCB_ALLOW_SLOPPY_LOCK=1;xvfb-run --server-args="-screen 0, 1024x768x24" ./phantomjs --load-plugins=yes ../examples/rasterize.js URL SCREENSHOT_FILE

Also to emulate Flash support in phantomjs browser you need to add before page.open the following (at least plugins and mimeTypes - to pass all Flash detection tests correctly)

page.onInitialized = function () {
        page.evaluate(function () {
            window.navigator = {
                plugins: {length: 2, 'Shockwave Flash': {name: 'Shockwave Flash', description: 'Shockwave Flash 11.6 r602'}},
                mimeTypes: {length: 2, "application/x-shockwave-flash":
                    {description: "Shockwave Flash", suffixes: "swf", type: "application/x-shockwave-flash", enabledPlugin: {description: "Shockwave Flash 11.6 r602"}}
                appCodeName: "Mozilla",
                appName: "Netscape",
                appVersion: "5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22",
                cookieEnabled: true,
                language: "en",
                onLine: true,
                platform: "CentOS 5.7",
                product: "Gecko",
                productSub: "20030107",
                userAgent: "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22",

If you have any troubles with failed flahs plugin initialization (on screenshots) you may need to downgrade to version 10 by the following command

yum erase flash-plugin
rpm -ivh http://dl.atrpms.net/el5-i386/atrpms/bleeding/flash-plugin-10.2-1.i386.rpm

All this makes headless PhantomJS browser work with modern Flash websites.


  1. Hi.

    I have Ubuntu 12 and I am trying to run phantomjs 1.4.1 on a flash site.
    Anyway I do it I get the same output, either "this page requires flash" if I don't include the "onInitialized" function, or a blank page if I include it.
    Using the --load-plugins=yes parameter makes no difference.

    I am using flash v11.2 r202 and I am finding it hard to install a different version. I have the .so file for v10 but I don't know what to do with it.

    Any idea what I could be doing wrong in order to render flash sites correctly?


  2. This comment has been removed by the author.

  3. This comment has been removed by the author.

  4. HELLPP! I'm an inexperienced computer user, but I know one effective method when there are such problems. I often play various browser games, this is my way to relieve stress after a hard day's work. When problems occur, I immediately download the desired software and reinstall it, for example for browser games, you often need to reinstall it https://yumdownload.com/adobe-shockwave-player . I do this with all the software and even with the operating system.

  5. Does grooming your own dog seem too hard? Use these 7 simple all breed dog grooming tips and give your dog that pristine look without breaking the CBD oil for dogs. These step by step tips teach you how to bathe, clip, and nail clip easily and quickly.

  6. Do you have pets and are concerned about leaving them when you travel? Have you worn out your favors with neighbors, family and friends? Have you had bad experiences with pet sitters who have claimed to be reliable and trustworthy and then found out the hard way there was cause for concern. The intention of this article is to help you in the process of finding a trustworthy, reliable and professional Cat names sitter for your needs.

  7. This article is directed at veterans who suffer from PTSD and Depression. It provides summary information on the holistic techniques that can be used to reverse PTSD and Depression in Veterans. These techniques include meditation, emotional release, diet, exercise, yoga, mindfulness, herbal remedies, Reiki and other forms of energy healing and CBD for sale Conventional treatment includes pharmaceutical drugs and talk therapy, which do not seem to work. The holistic approach includes mind, body and spirit techniques that can be integrated with conventional treatment.

  8. Baby dresses are going to be in direct contact with baby skin, and for this reason you should use mild detergents when washing baby dresses. cheap flower girl dresses do get a lot of things spilled, or spewed, onto them, and these spills often cause stains. The mild detergents are not as good at removing stains so you will need to take some precautions to keep the baby dresses clean and looking good.

  9. Both tetrahydrocannabivarin (THCV) and cannabidiol (CBD) are phytochemicals similar to the active ingredient in marijuana, but without the psychoactive effects. According to a report published in the journal Diabetes Care in August 2016, both molecules could be helpful in treating high blood sugar levels in people who have been diagnosed with Type 2 diabetes. Scientists at the University of Nottingham in cbd and several other research institutions in the UK looked at 62 participants with a Type 2 diabetes diagnosis.

  10. Great post mate, thank you for the valuable and useful information. Keep up the good work! FYI, please check these depression, stress and anxiety related articles:

    Depression Cure

    Depression Management Tips

    Dealing With Depression

    Ways To Get Rid of Depression

    Overcoming Depression

    you can also contact me at depressioncure.net@gmail.com for link exchange, article exchange or for advertisement.


  11. As with any major city, the cost of parking in the Sydney CBD can be out of control. Fortunately, there are solutions. There is a multitude of private owners of parking space out there who are willing to sell or rent parking space https://royalcbd.com/

  12. This is a very good tip particularly to those fresh to the blogosphere.Short but very accurate info… Many thanks for sharing this one.A must read article!my web blog 123Movies

  13. Great Post! I look forward to seeing more from you in the future. There are some very great ideas above Fmovies

  14. Good post! We will be linking to this particularly great post on our website.Keep up the good writing. Yesmovies

  15. Assignment help is given the full profession lift to the students in which we control the students to make the correct stride throughout everyday life and show signs of improvement opportunity throughout Solarmovie

  16. Its very useful, without read your article, it hard to think about. Thank you so much Jav Online

  17. That’s true, i have same opinion with you about this. We should together figure this out Jav Streaming

  18. Thank for your support and very preciate that. What an useful articles Japanese Porn

  19. Thank you and thank for your shared, i will introduce to my friend to visit your website more often
    Jav Censored

  20. Marvelous, what a weblog it is! This website presents helpful information to us, keep it 123Movies

  21. I wish I could craft such articles as this. Thank you very much.

  22. There as certainly a great deal to find out about this topic. I really like all of the points you made. Bệnh Lậu