1

casperjs を使用してファイルをアップロード中に問題が発生しました。以下はサイトのリンクです: http://207.140.168.200/login.R 以下は HTML コンテンツです。

<div id="collapse-file-upload" class="panel-collapse in" data-colwidth="2" style="height: auto;">
<img class="panel-shadow right" width="5px" height="105" src="/img/left_bordergray.png">
<div class="panel-body" style="height: 105px;">
<div id="file-upload-div" class="widget-vsize">
<div id="file-upload-wrapper">
<div id="file-upload-controls" class="btn-group-sm">
<input id="file" type="file" multiple="" style="display: inline;">
<span class="checkbox" style="display: inline-block; padding-top: 6px;">
<label>
<input id="upload-to-notebook" type="checkbox">
<span>Upload to notebook</span>
</label>
</span>
<button id="upload-submit" class="btn btn-default-ext" style="float: right;width: 33px;" type="submit">
<i class="icon-upload-alt"></i>
</button>
<div class="progress" style="display:none">
<div id="progress-bar" class="progress-bar" style="width: 0%" aria-valuemax="100" aria-valuemin="0" aria-valuenow="0" role="progressbar">   
</div>
</div>
</div>
<div id="file-upload-results-row">
<div id="file-upload-results-scroller">
<div id="file-upload-results"> </div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

以下は、自動化に使用しているcasperjsコードです

casper.then(function(){
casper.evaluate(function () {
    var element = document.getElementById('file');
    this.sendKeys(element, '/home/prateek/Download/Notebook 1.R');
    this.wait(3000)
});
this.click({ type : 'css' , path : '#upload-submit'});
this.echo('file has been uploaded')
});

その場所からファイルを選択することはまったくありません。すべての操作が進行していることを確認できるように、ヘッドレスで実行していないことに注意してください

4

1 に答える 1