简体   繁体   中英

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?

以我的经验,有时页面会不断用ajax刷新,这可能会发生。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM