How to set the browser language of PhantomJS

£可爱£侵袭症+ 提交于 2019-12-18 09:12:31

问题


I'm using DalekJS with PhantomJS to test a web application. I have important assertions which depend on the browser language. And these fail if the language is not English.

Any Ideas how I can set the default browser language of pantomjs??

Cheers izocan.


回答1:


This question has been further discussed here: https://groups.google.com/forum/#!topic/dalekjs/HHt6eoZRQc4




回答2:


Let me answer my own question:

The problem is solved when you use following code in your index.html:

  <script>
    localStorage.lang = 'en';
  </script>

So the site will be displayed in english no matter which browser is used.



来源:https://stackoverflow.com/questions/22981929/how-to-set-the-browser-language-of-phantomjs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!