tags:

views:

93

answers:

1

The ContainsText method finds the text only in specific area in the html but fails to find id in other parts of the page. The text that located under 'div id="content"' can be found But the text in other area of the html is not found (f.e 'form id="aspnetForm"')

        Browser b = new FireFox("http://localhost:8668/login.aspx");
        b.Button("login.login.button")).Click();
        bool blah = b.ContainsText("Hello");

I'm using the latest watin release. The issue is reproduced with FF3.0, FF3.5 and FF3.6 In IE it's working fine for the tested text.

+1  A: 

Used workaround:

By parsing the html with html agility pack

Looks like this:

    public bool ContainsTextInternal(string text)
    {
        var htmldoc = new HtmlDocument();
        htmldoc.LoadHtml(browser.Html);
        return htmldoc.DocumentNode.InnerText.Contains(text);
    }

html agility pack link

alonp