nightmarecodeceptjs

Cannot get a valid selector to implement I.click()


I am trying to click a button that has these details when I 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>

I have copied xpath and I had a code like this=> I.click('//*[@id="9"]');

and I got this error Clickable //*[@id="9"] was not found by text|CSS|XPath

What am I doing wrong?


Solution

  • It works now! I used the specific Identifier

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