gpt4 book ai didi

javascript - 无法使用 casperjs 单击建议结果

转载 作者:行者123 更新时间:2023-12-03 08:26:14 24 4
gpt4 key购买 nike

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

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

最佳答案

也许对你有帮助

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);
});

关于javascript - 无法使用 casperjs 单击建议结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33538465/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com