0

Documentation states that "When a selector is executed, TestCafe waits for the target node to appear in the DOM until the selector timeout expires." and we don't use expect(Selector.exists).ok() in code sample below the statement. However in another paragraph we see that the Smart Assertion Query Mechanism does not wait for page elements to appear. If you need to wait for an element before executing an assertion, add another assertion that checks the selector’s count or exists property. and in code we see the .exist assertion (.expect(nameInput.exists).ok());

My question is: should I check for existence of an element of I can use assertions like expect(elementSelector[anyProperty]) without this pre-check?

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

1 Answers1

1

No, you shouldn't check whether an element exists. I agree that the documentation indeed may be confusing. We have created an issue regarding this question: