これが役立つかどうかはわかりません... nightwatch.js を使用してアプリをテストし、単一ファイル用の flowJS アップロード ボタンを用意しました。
これを機能させるには、隠しファイルの入力を表示して有効にする必要がありました。次に、ファイルの場所を入力して送信できます。
nightwatch.js のサンプル
//Re-enable traditional file-input
this.api.execute(function () {
document.getElementById('proof-upload-fallback').className = '';
document.getElementById('proof-upload-fallback').disabled = false;
});
this.api.setValue('//input[@id="proof-upload-fallback"]', require('path').resolve(filePath));
//Click upload
this.api.clickModalButton('Upload');
html は次のようになります。
<input id="proof-upload-fallback" type="file" flow-btn="" ng-show="false" ng-disabled="true" class="ng-hide" />
<button flow-btn="" focus-input="focusButton">Select PDF<input type="file" style="visibility: hidden; position: absolute; width: 1px; height: 1px;"></button>
Submit: <button ng-click="ok()">Upload</button>
ng-click="ok" は flow.js の処理を担当します。コードの重要な部分は、selenium ドライバーを介して実際の webapp に渡される JS である execute() です...