SanshouSichimiYa

備忘録の為のブログ

MacOS Sierraでcapybara-webkitを動かす

Sierraでcapybara-webkitを動かしたので、その備忘録です。ざっくり。

注意

これは2016年10月02日現在の方法です。

参照

capybara-webkitwikiそのまんまです。詳しくはこちらで確認してください。

Installing Qt and compiling capybara webkit · thoughtbot/capybara-webkit Wiki · GitHub

Qt 5.5をインストール

以下のURLからqt-opensource-mac-x64-clang-5.5.1.dmgをダウンロードしてきてdefaultオプションでインストールする。

https://download.qt.io/archive/qt/5.5/5.5.1/

default_pre.prfを編集

[Qt_install_folder]/[Qt_version](/clang_64 || )/mkspecs/features/mac/default_pre.prf15行目を以下に書き換える

isEmpty($$list($$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null"))): \

capybara-webkitをインストールする

Gemfileへgem 'capybara-webkit'を記述して

PATH=$PATH:/Users/your_user_name/Qt5.5.1/5.5/clang_64/bin bundle install

テストを実行…できるまで

テストを実行

bundle exec rake test

エラーが発生

    Sorry, you can’t use byebug without Readline. To solve this, you need to
    rebuild Ruby with Readline support. If using Ubuntu, try `sudo apt-get
    install libreadline-dev` and then reinstall your Ruby.
rake aborted!

rubyを削除して、再インストールを行う

$ rbenv uninstall 2.3.1
$ rbenv install 2.3.1

テストを実行するとまたエラーが発生。

ただ、テストそのものは動いてる模様。

objc[78787]: Class ObjCTimerObject is implemented in both /Library/Internet Plug-Ins/AdobePDFViewerNPAPI.plugin/Contents/MacOS/AdobePDFViewerNPAPI (0x1117d7c58) and /Library/Internet Plug-Ins/AdobePDFViewer.plugin/Contents/MacOS/AdobePDFViewer (0x111835008). One of the two will be used. Which one is undefined.
objc[78787]: Class AdobePDFProgressView is implemented in both /Library/Internet Plug-Ins/AdobePDFViewerNPAPI.plugin/Contents/MacOS/AdobePDFViewerNPAPI (0x1117d7ac8) and /Library/Internet Plug-Ins/AdobePDFViewer.plugin/Contents/MacOS/AdobePDFViewer (0x1118350a8). One of the two will be used. Which one is undefined.
2016-10-02 19:21:09.285 webkit_server[78787:1318059] Cannot find executable for CFBundle 0x7fb5c4c7af90 </Library/Internet Plug-Ins/Disabled Plug-Ins> (not loaded)

adobeのサイトを参照して、2つのプラグインを削除

Safari プラグインの問題に関するトラブルシューティング(Macintosh 版 Acrobat X/Adobe Reader X)

2016-10-02 19:21:09.285 webkit_server[78787:1318059] Cannot find executable for CFBundle 0x7fb5c4c7af90 </Library/Internet Plug-Ins/Disabled Plug-Ins> (not loaded)

このエラーは残っており、調べてもいまいち解決できなかった事やテストは動いているのでひとまずこれで終了。


その場しのぎ的です。