Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
phantomjsには(nodejsからの)node_modulesに似たものがありますか?
これはrequire('moduleName');、コードをよりクリーンにするためのようなものを使用できるようにするためです。
require('moduleName');
injectJsを使用して、ファントムスクリプトを動的にロードできます。
console.log(phantom.injectJs('./path-to-file.js'));
ウィキから
injectJs(filename){boolean}
指定されたファイルからPhantom宇宙空間に外部スクリプトコードを挿入します。現在のディレクトリでファイルが見つからない場合は、libraryPathを使用して追加の検索を行います。この関数は、注入が成功した場合はtrueを返し、それ以外の場合はfalseを返します。
https://github.com/ariya/phantomjs/wiki/API-リファレンス