无法使用casperjs单击建议的结果

时间:2015-11-05 07:04:07

标签: javascript jquery casperjs

我有一个带用户输入字段的模态窗口。当我在字段中键入任何名称时,会出现建议下拉菜单(例如在谷歌搜索页面建议中)。我无法点击下面的第一个建议是带有建议的字段的屏幕截图

Text field with suggestions

这是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它正在工作但无法点击建议的名称字段

1 个答案:

答案 0 :(得分:1)

它可能对你有帮助

{{1}}
相关问题