ContainsText could not find Text for FireFox

6 posts, 0 answers
  1. f tan
    f tan avatar
    5 posts
    Member since:
    May 2010

    Posted 03 Aug 2010 Link to this post

    Installed WebAii Automation Framework Version 2.0 of July 13, 2010. created a simple test.  ActiveBrowser.ContainsText("ArtOfTest") does not work for FF, though it works for IE. Not sure what went wrong.

     public void SampleWebAiiTest()
            {
                // Launch a browser instance
                //Manager.LaunchNewBrowser(BrowserType.InternetExplorer);
                Manager.LaunchNewBrowser(BrowserType.FireFox);

                // The active browser
                ActiveBrowser.NavigateTo("http://www.google.com");

                // Find the google search box and set it to "ArtOfTest";
                Find.ByName<HtmlInputText>("q").Text = "ArtOfTest";

                // Click the Search button
                Find.ByName<HtmlInputSubmit>("btnG").Click();

                // Validate the search contain the 'ArtOfTest' text
                bool art = ActiveBrowser.ContainsText("ArtOfTest");
                Assert.IsTrue(art);
            }
  2. John Woakes
    John Woakes avatar
    9 posts
    Member since:
    Mar 2009

    Posted 03 Aug 2010 Link to this post

    This sounds like the same problem I am getting. What are your symptoms? Does IE open but not navigate to your page?

    I fixed this on one machine by uninstalling WebAii and reinstalling but I am now getting the same behaviour on another machine and cannot fix it. The machine that is proving reluctant is running XP 64bit and IE 7.
  3. f tan
    f tan avatar
    5 posts
    Member since:
    May 2010

    Posted 03 Aug 2010 Link to this post

    The issue is ContainsText could not find the specified text string with FireFox, and returns false. Test works fine with IE browser. My machine is XP, and Firefox is version 3.6.3
  4. Konstantin Petkov
    Admin
    Konstantin Petkov avatar
    1911 posts

    Posted 10 Aug 2010 Link to this post

    Hello f tan,

    I ran this same sample test on an XP on Firefox 3.6 and it passed. I had to configure the browser as per these requirements though. I also upgraded the browser to the very latest Firefox v3.6.8 and got no problem with the test.

    However there is one difference I noticed with you -- I'm running a more recent version of the WebAii Testing Framework. Can you please upgrade to the latest internal build of the framework and let us know whether that solves the problem on your end? Thank you!

    Regards,
    Konstantin Petkov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. f tan
    f tan avatar
    5 posts
    Member since:
    May 2010

    Posted 10 Aug 2010 Link to this post

    Dear Konstantin,

    I upgraded to latest internal build of the framework, and updated FireFox to version, 3.6.8, Still got the same issue. -- i.e. script ran failed  with FireFox at // Validate the search contain the 'ArtOfTest' text
                bool art = ActiveBrowser.ContainsText("ArtOfTest");
    But IE works fine.

    Thanks for tracking this.

    FTAN
  6. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 10 Aug 2010 Link to this post

    Hi f tan,

    Thanks for reporting this issue. I was able to reproduce the problem. It appears Firefox changed what it returns in the ViewSourceString property which is what the test was using under the covers. I've redesigned our sample test. The new code is as follows:

    [TestMethod]
    public void SampleWebAiiTest()
    {
        // Launch a browser instance
        Manager.LaunchNewBrowser(BrowserType.InternetExplorer);
     
        // The active browser
        ActiveBrowser.NavigateTo("http://www.google.com");

        // Find the google search box and set it to "ArtOfTest";
        Find.ByName<HtmlInputText>("q").Text = "ArtOfTest";
     
        // Click the Search button
        Find.ByName<HtmlInputSubmit>("btnG").Click();
     
        // Wait for the results array to be returned
        ActiveBrowser.WaitForElement(new HtmlFindExpression("id=rso"), 10000);
     
        // Fetch the first result
        HtmlOrderedList list = Find.ByExpression<HtmlOrderedList>("id=rso");
        HtmlListItem firstResult = list.Items[0];
     
        // Validate the search contain the 'ArtOfTest' text
        firstResult.AssertContent().InnerText(ArtOfTest.Common.StringCompareType.Contains, "Automated Testing Tools by Telerik");
    }


    Greetings,
    Cody
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top