How to find a specific element, or a list of elements by using their TagName using Watin?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
As of WatiN 2.0 beta 1 this has changed to:
ie.ElementWithTag("h1", constraint);
Constraints are created when using the Find.XXX methods.
Here is an example:
ie.ElementWithTag("h1", Find.ByClass("blue");
回答2:
For example, to find the first <h1> on a page, use:
ie.Element("h1", Find.ByIndex(0))
回答3:
this is what worked for me:
var element = ie.Element(x => x.Text == "[innerText]" && x.TagName == "[tagname]");