5

I am using PhantomJs 1.9.2 on Centos 6.3 to for automated ui tests. When a test fails, screenshots are saved to the server.

My problem is that even though the screenshots are saved, they do not contain readable fonts.

So if the website reads like this:

חיים טכנולוגיים

the screenshot of the site will look like this:

םםםםםםםםםםםםם

So, instead of the actual letters, it renders and saves little boxes.

The system is centos 6.3. Freetype and Fontconfig are also installed.

How could I go about fixing this?

Thanks!

Vitthal
  • 327
  • 1
  • 13
Rakesh Jangid
  • 190
  • 1
  • 10
  • Do you save the screenshots in pdf or png? Have you tried updating (compiling) phantom to 1.9.7? – Artjom B. May 21 '14 at 15:04
  • I am saving screenshot in jpeg, and taking perfect screenshot on my local machine in any language. but on server it render only english language fonts. – Rakesh Jangid May 22 '14 at 05:19
  • we update the phantomjs. now its version is 1.9.7 . But still fonts are coming like boxes – Rakesh Jangid May 22 '14 at 07:13
  • possible duplicate of [phantomjs screenshot font missing, boxes rendered instead](http://stackoverflow.com/questions/15029002/phantomjs-screenshot-font-missing-boxes-rendered-instead) – Artjom B. Jul 20 '14 at 08:24

3 Answers3

3

follow these steps:

in /usr/share/fonts/ I added a folder named arial with the arial.ttf for hebrew I ran fc-cache -vf. That's it! I did not edit or change fonts.conf or did anything else as suggested in the link.

1

I recently had to fix the same problem myself. I ended up doing what's suggested in the this answer. Well, sort of. I skipped some of the steps:

  1. in /usr/share/fonts/ I added a folder named arial with the arial.ttf for hebrew
  2. I ran fc-cache -vf.
  3. That's it! I did not edit or change fonts.conf or did anything else as suggested in the link.

Granted, I still had a little trouble with parts of the page (I'm guessing it was because they were using fonts other than arial), but I ended up not needing them. Hopefully that'll be good enough for you too!

Community
  • 1
  • 1
yuvi
  • 18,155
  • 8
  • 56
  • 93
1

You should use python code for taking screenshots of website. there are two module which will do whatever you want pyvirtualdisplay & selenium. Install them and write a class to create screenshot and call it with command line with your code. Best of luck...