LoginSignup
5
4

More than 5 years have passed since last update.

Xvfb+Firefoxで"Error: No running window found"となってハマりかけた話

Last updated at Posted at 2014-06-10

結論 man firefoxをちゃんと読もう

Xvfb上でFirefoxから http://www.google.co.jp/ へアクセスしようとしたら"Error: No running window found"

$ Xvfb :1 &
$ DISPLAY=:1 firefox -remote "openURL(http://www.google.co.jp/)" &

結果は”Error: No running window found”とエラーを吐いて、Firefoxはプロセス終了

Error: No running window found

何がダメだったの?

Firefox の remote オプションで指定したコマンドは、実行中のFirefoxプロセス上で発行される。(後述のman firefoxを参照)
なので、Firefoxのプロセスを起動せずに、remoteオプションでコマンドを発行しようとしていたため、

実行中のFirefoxのウインドウがないよ!(Error: No running window found)

と怒られたわけです。

正しくはこうする

$ Xvfb :1 &
$ DISPLAY=:1 firefox http://www.google.co.jp/ &

もしくは

$ Xvfb :1 &
$ DISPLAY=:1 firefox &
$ firefox -remote "openURL(http://www.google.co.jp/)"


もしくは

$ Xvfb :1 &
$ DISPLAY=:1 firefox -a firefox -remote "openURL(http://www.google.co.jp/)" &

man firefoxにはこう書いてあった

man
       -remote command
              Execute command in an already running Firefox process.  For more info, see: http://www.mozilla.org/unix/remote.html

すでに動いているFirefoxのプロセス上でコマンドを実行します って書いてある。
ちゃんと読もう >自分。

5
4
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
5
4