cherry
cherry

Reputation: 21

Sometimes can get text but sometimes show "Unable to find element with selector"

I use var n = I.Find(("#CSS_path"); to find a element and click it.I want to compare the text inside element.So I tried to use var nt = n.Element.Text; and string name = n.Element.ToString(); to get the text inside.ToString() can't get it. So I use n.Element.Text.But it sometimes can get the text, sometimes show the wrong "Unable to find element with selector".And I also tried to use var nt = n.Element.Text; string name = nt.ToString();.But it still has the same problem. By the way, n.element is not null.It has the right text that I want to compare.

Why this would happen?Did I do something wrong?

Upvotes: 0

Views: 145

Answers (1)

kiro
kiro

Reputation: 111

In my experience,Sometimes when the page keep refreshing with ajax,it may occur.

Upvotes: 0

Related Questions