スキップしてメイン コンテンツに移動

Setup Headless Browser

Recently I was trying to setup Selenium Tests on CI Server on Linux (Cent OS) box in order to test my web project.

I need headless browser for Selenium Tests on CI Server. There are 2 options:
PhantomJS is really cool and I confirmed it worked fine on my Windows XP. I would have liked to use PhantomJS on my Linux box, too. However looks the latest binary build is unable to run on my Linux box because the required libc and libstdc++ are missing in the box:
$ phantomjs/bin/phantomjs
phantomjs/bin/phantomjs: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by phantomjs/bin/phantomjs)
phantomjs/bin/phantomjs: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by phantomjs/bin/phantomjs)
phantomjs/bin/phantomjs: /lib64/libc.so.6: version `GLIBC_2.7' not found (required by phantomjs/bin/phantomjs)
phantomjs/bin/phantomjs: /lib64/libc.so.6: version `GLIBC_2.7' not found (required by /home/duke/bin/phantomjs/bin/../lib/libQtGui.so.4)
phantomjs/bin/phantomjs: /lib64/libc.so.6: version `GLIBC_2.9' not found (required by /home/duke/bin/phantomjs/bin/../lib/libQtGui.so.4)
phantomjs/bin/phantomjs: /lib64/libc.so.6: version `GLIBC_2.11' not found (required by /home/duke/bin/phantomjs/bin/../lib/libQtGui.so.4)
phantomjs/bin/phantomjs: /lib64/libc.so.6: version `GLIBC_2.10' not found (required by /home/duke/bin/phantomjs/bin/../lib/libQtNetwork.so.4)
phantomjs/bin/phantomjs: /lib64/libc.so.6: version `GLIBC_2.9' not found (required by /home/duke/bin/phantomjs/bin/../lib/libQtCore.so.4)

I decided to go for FireFox + Xvfb.
(Of course I can upgrade the OS or install those required libraries but the install process is a bit pain for me. I have tried to compile PhantomJS from its source code but I needed to install QtWebKit library. I gave up.)
I have installed FireFox 10 and Xvfb in a just simple manner from yum. I executed the following command.
Xvfb :1 -screen 0 1024x786x24
I got the following 4 error messages during Xvfb running. As a result first, Xvfb works very well with FireFox although I only solved the second error message.
  1. FreeFontPath: FPE "unix/:7100" refcount is 2, should be 1; fixing.
    I have googled and then found following page and installed missing fonts but unfortunately the error message keep appearing. http://corpocrat.com/2008/08/18/fix-freefontpath-fpe-unix7100-refcount-is-2-should-be-1-fixing/
    http://stackoverflow.com/questions/7522808/freefontpath-fpe-unix-7100-refcount-is-2-should-be-1-fixing

  2. Could not init font path element unix/:7100, removing from list!
    I applied below 2 changes to my box, the error message was gone :)
    • Just start /etc/init.d/xfs
    • Also you need to check /sbin/chkconfig --list and enable the service on proper Linux Run Level.
      Initial setting on my box, the service is off on all run level.
      xfs             0:off   1:off   2:off   3:off   4:off   5:off   6:off
      

  3. _XSERVTransSocketOpenCOTSServer: Unable to open socket for inet6
    _XSERVTransOpen: transport open failed for inet6/foobar.com:1
    _XSERVTransMakeAllCOTSServerListeners: failed to open listener for inet6

    According to this page, just need to give putting "-nolisten tcp" into serverargs in startx. I have not tried though.
    Another option is enabling inet6 following this page.

  4. error opening security policy file /usr/lib64/xserver/SecurityPolicy
    Have not found proper solution yet but I think just need to give a SecurityPolicy file?

Will update if I find cleaner or better solution for these errors.

コメント