开发者

How to create ElementFinder in WatiN?

In Wat开发者_StackOverflowiN RC1 how can I create ElementFinder which will find any element on page?


Here is what I found out.

I can create ElementFinder using two ways

First. When creating custom control (extending Div, Table and so on) there is a protected method CreateElementFinder<T>. Here is an example:

var elementFinder = CreateElementFinder<Element>(
    nativeEl => nativeEl.AllDescendants,
    Find.ById("id"));

Second. If you are not extending any control you can use NativeElementFinder constructor. Here is an example:

var finder = new NativeElementFinder(
    () => browser.Body.NativeElement.AllDescendants,
    browser.DomContainer,
    new[] { ElementTag.Any },
    Find.ById("id"));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜