我正在使用casperJS导入文件,下面是对话框的HTML脚本和图片
<div class="container">
<p>Import notebooks from another GitHub instance.</p>
<p>Currently import does not preserve history.</p>
<p>
source repo api url:
<input id="import-source" class="form-control-ext" type="text" value="https://api.github.com" style="width:100%;">
</p>
<p>
notebooks:
<br>
<textarea id="import-gists" class="form-control-ext" form="port" cols="30" rows="10" style="height: 20%;width: 50%;max-width: 100%"></textarea>
</p>
<p>
prefix (e.g.
<code>folder/</code>
to put notebooks in a folder):
<input id="import-prefix" class="form-control-ext" type="text" style="width:100%;">
</p>
</div>
场景是我需要在笔记本字段中输入笔记本的 ID,然后单击导入。下面是我使用的 casperJS 代码
casper.then(function(){
this.click({type:'xpath', path:".//*[@id='rcloud-navbar-menu']/li[3]/a"});
if(this.test.assertVisible('#import_notebooks'),"Import external notebook is visible")
{
this.click('#import_notebooks');
}else
{
console.log('Import external notebook is not visible');
}
this.wait(2000);
});
casper.then(function(){
this.sendKeys({type:'css',path:"#import-gists"}, notebookID);
this.click('.btn.btn-primary');
});
对话框打开但无法在笔记本字段中输入文本。