nightmare - 无法获得有效的选择器来实现I.click()

标签 nightmare codeceptjs

我尝试在F12时单击包含这些详细信息的按钮
<a data-codecept="searchGo" id="9" class="a-button a-button--white clearfix block showall" suggestrow"="" alt="/s/lundhags/?searchparam=lundhags" onmouseover="suggest.handleMouseOver(9);" onmouseout="suggest.handleMouseOut(9)" onclick="suggest.handleSubmit();" xpath="1">Show all results for 'lundhags'<span class="a-icon a-button__icon a-button__icon--double-arrow"></span></a>
我已经复制了xpath并且有这样的代码=>I.click('//*[@id="9"]');
我得到这个错误Clickable //*[@id="9"] was not found by text|CSS|XPath
我究竟做错了什么?

最佳答案

现在可以使用了!我使用了特定的标识符

I.click('[data-codecept="searchGo"]');

关于nightmare - 无法获得有效的选择器来实现I.click(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56557765/

相关文章:

javascript - Nightmare JS 不工作

javascript - 使用 Tape 和 Nightmare.js 进行 ES6 javascript 测试

qa - CodeceptJS和Nightmare-在帮助程序类中的套件之前设置cookie

testing - 需要 codeceptjs 的自动完成插件

javascript - Mac OS X 上的性能缓慢

javascript - 如何自动化 ElectronJS 应用程序

javascript - 使用nightmare.js发出各种请求

javascript - codeceptJS/webdriverIO 使用抓取命令退出脚本

javascript - 带有 Nightmare 的 Codeceptjs 不输出测试结果

selenium-chromedriver - 如何使用 Playwright 更改默认语言 Chromium/Firefox?