1

I am trying to do a smoke test on a web page and essentially if I can somehow get Testcafe to remember "Hello World" from page 1 and go to a User Profile to match that same element with the text "Hello World" then I can make it work for all the other cases I will have

I am currently using Testcafe in a mac environment. I tried selectText but it wouldn't work for me.

I expect when Testcafe clicks on a tab that says "Hello World" and on the next page it can match the title with the same time from the previous tab

Alex Skorkin
  • 4,264
  • 3
  • 25
  • 47
DjKniteX
  • 81
  • 4

1 Answers1

3

After you take DOM element you can take it's text using textContent property (see doc)

You can then save this text to variable and use it to compare with text on another page

const h1Text = await Selector("h1").textContent
RedVarVar
  • 572
  • 2
  • 7
  • That seemed to work! Thanks; I read through the documentation several times and I guess I missed that section; my Test failed but I think I know what's wrong. Are you a Testcafe guru? I have another TC related question – DjKniteX Aug 19 '19 at 17:18
  • @DjKniteX - what is your question? I'd just start a new 'thread' within StackOverflow...many people can help then. – TallKU Aug 19 '19 at 18:53