LoginSignup
4
5

More than 5 years have passed since last update.

phantomjsとselenium

Last updated at Posted at 2016-03-10

javascriptに対応する

備考

  • Debian wheezy

  • Selenium

  • Phantom.js

  • PyVirtualDisplay

インストール

単純にSeleniumとPhantom.jsをインストールしてテストするがエラーも何も出ず実行もされていない様子

Phantom.jsのみ実行するとエラーに

phantomjs QXcbConnection Could not connect to display

デスクトップも入っていない環境なのでそもそも描画すらできないために出た模様。
調べると以下が見つかる

Python - Taking Browser Screenshots With No Display (Selenium/Xvfb)

xvfbとPyVirtualDisplayをインストールして正常にphantom.jsが動くようになったことを確認。pythonからPyVirtualDisplay経由でも問題なし。

Phantom.jsはDebianでもaptに上がっていた
phantomjs_2.1.1

適当に環境作っているのでいいかげん汚くてしょうがない。
pyenvかコンテナを使った方がいいのか。

4
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
5