特定のダッシュボードでリストを作成するテスト ケースを自動化する必要があります。PhantomJS ヘッドレス ブラウザを使用することにしました。私はそれが初めてなので、自分でテストを作成してみました。以下は、ターゲット Web サイトを開くためだけに実行した手順です。
- 作成されたディレクトリ
phantoms
cd phantoms
コマンドを使用してファントムモジュールをインストールしましたnpm install phantom --save
- 作成されたファイル
createlist.js
:
createlist.js の内容:
var phantom = require('phantom');
var page = require('webpage');
page.open('http://facebook.com', function(status) {
console.log("Status: " + status);
if(status === "success") {
page.render('example.png');
}
phantom.exit();
});
コマンドnode create_list.js
を実行すると、次のエラーが発生します。
page.open('interact2.responsys.net/interact/jsp/jindex.jsp', function(st atus) { ^ TypeError: page.open is not a function at Object.<anonymous> (C:\Users\shilshet\New folder\phantom\create_list.js:3 :6) at Module._compile (module.js:413:34)
次のようなコマンドを実行しようとすると
phantomjs C:/Users/shilshet/New folder/phantom/create_list.js
このエラーが発生しています
bash: phantomjs: command not found
注:コマンドの実行にcygwinを使用しています
私は何が間違っているのですか?node.js と同じフォルダーに、phantomjs モジュールもインストールしました。
ヘッドレスブラウザを使用する以外に、REST API呼び出しを介してOracle responsysでプロファイルリストを作成するにはどうすればよいですか?