【问题标题】:Cannot get a valid selector to implement I.click()无法获得有效的选择器来实现 I.click()
【发布时间】:2019-10-26 16:56:49
【问题描述】:

当我按 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

我做错了什么?

【问题讨论】:

    标签: nightmare codeceptjs


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-04-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-28
      • 2016-05-21
      • 2012-01-20
      • 1970-01-01
      相关资源
      最近更新 更多