-1

I am trying to use Nightwatch to test the process of a user logging in using a log in text link. I checked out this: How to click a link using link text in nightwatch.js article which told me to use:

.useXpath()     // every selector now must be XPath
.click("//a[text()='Two']")
.useCss()      // we're back to CSS now

However that doesnt work.

The link I am trying to click is:

<li>
  <a href="/user/login">
      <strong>Sign in</strong>
  </a>
</li>

and I have tried:

.useXpath()
.click("a[text()='Sign in')]")
.useCss()

Any ideas?

modusTollens
  • 397
  • 7
  • 23

1 Answers1

2

I see // is missing in your xpath locator

Try this

.useXpath()
.click("//a[text()='Sign in')]")
.useCss()
Navarasu
  • 8,209
  • 2
  • 21
  • 32