This is a migrated thread and some comments may be shown as answers.

ContainsText could not find Text for FireFox

5 Answers 82 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
f tan
Top achievements
Rank 1
f tan asked on 04 Aug 2010, 12:34 AM
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);
        }

5 Answers, 1 is accepted

Sort by
0
John Woakes
Top achievements
Rank 1
answered on 04 Aug 2010, 01:00 AM
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.
0
f tan
Top achievements
Rank 1
answered on 04 Aug 2010, 01:09 AM
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
0
Konstantin Petkov
Telerik team
answered on 10 Aug 2010, 07:56 AM
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
0
f tan
Top achievements
Rank 1
answered on 10 Aug 2010, 04:18 PM
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
0
Cody
Telerik team
answered on 11 Aug 2010, 12:10 AM
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
Tags
General Discussions
Asked by
f tan
Top achievements
Rank 1
Answers by
John Woakes
Top achievements
Rank 1
f tan
Top achievements
Rank 1
Konstantin Petkov
Telerik team
Cody
Telerik team
Share this question
or