无法使用casperjs点击建议的结果
Unable to click on suggested results using casperjs
我有一个带有用户输入字段的模式 window。当我在字段中键入任何名称时,会出现建议下拉列表(如 google 搜索页面建议)。我无法点击第一个建议 下面是建议字段的屏幕截图
这里是 html 片段
<div class="selectize-control ng-pristine ng-untouched ng-valid ng-isolate-scope multi">
<div class="selectize-input items not-full ng-valid ng-pristine has-options">
<input type="text" autocomplete="off" tabindex=""
style="width: 4px; opacity: 1; position: relative; left: 0px;">
</div>
<div class="selectize-dropdown ng-pristine ng-untouched ng-valid ng-isolate-scope multi"
style="display: none; width: 448px; top: 100px; left: 0px; visibility: visible;">
<div class="selectize-dropdown-content">
<div class="option" data-selectable="" data-value="djoky">
<span class="highlight">djo</span>
ky
</div>
</div>
</div>
测试用例场景为:
1.点击字段
2.输入名字,出现建议
3.点击建议
这是我的 CasperJS 代码
this.sendKeys(x(".//*[@id='group-tab']/div[3]/div/div/div[1]"), 'djoky');
this.echo('adding member name');
this.wait(3000);
this.click(x(".//*[@id='group-tab']/div[3]/div/div/div[2]/div/div/span"));
this.echo('Clicking the name from the member suggested');
});
直到 sendKeys 它正在工作,但无法点击建议的名称字段
可能对你有帮助
casper.then(function (){
this.click(x(".//*[@id='group-tab']/div[3]/div/div/div[1]"));
this.echo('Click 1');
this.sendKeys(x(".//*[@id='group-tab']/div[3]/div/div/div[1]"), 'dj');
this.echo('typing');
this.wait(3000);
this.click(x(".//*[@id='group-tab']/div[3]/div/div/div[2]/div/div"), 'djoky', {keepFocus: true});
this.echo('Click from the list');
this.wait(4000);
});
我有一个带有用户输入字段的模式 window。当我在字段中键入任何名称时,会出现建议下拉列表(如 google 搜索页面建议)。我无法点击第一个建议 下面是建议字段的屏幕截图
这里是 html 片段
<div class="selectize-control ng-pristine ng-untouched ng-valid ng-isolate-scope multi">
<div class="selectize-input items not-full ng-valid ng-pristine has-options">
<input type="text" autocomplete="off" tabindex=""
style="width: 4px; opacity: 1; position: relative; left: 0px;">
</div>
<div class="selectize-dropdown ng-pristine ng-untouched ng-valid ng-isolate-scope multi"
style="display: none; width: 448px; top: 100px; left: 0px; visibility: visible;">
<div class="selectize-dropdown-content">
<div class="option" data-selectable="" data-value="djoky">
<span class="highlight">djo</span>
ky
</div>
</div>
</div>
测试用例场景为: 1.点击字段 2.输入名字,出现建议 3.点击建议
这是我的 CasperJS 代码
this.sendKeys(x(".//*[@id='group-tab']/div[3]/div/div/div[1]"), 'djoky');
this.echo('adding member name');
this.wait(3000);
this.click(x(".//*[@id='group-tab']/div[3]/div/div/div[2]/div/div/span"));
this.echo('Clicking the name from the member suggested');
});
直到 sendKeys 它正在工作,但无法点击建议的名称字段
可能对你有帮助
casper.then(function (){
this.click(x(".//*[@id='group-tab']/div[3]/div/div/div[1]"));
this.echo('Click 1');
this.sendKeys(x(".//*[@id='group-tab']/div[3]/div/div/div[1]"), 'dj');
this.echo('typing');
this.wait(3000);
this.click(x(".//*[@id='group-tab']/div[3]/div/div/div[2]/div/div"), 'djoky', {keepFocus: true});
this.echo('Click from the list');
this.wait(4000);
});