Topic
  • 4 replies
  • Latest Post - ‏2012-05-08T13:37:31Z by SystemAdmin
SystemAdmin
SystemAdmin
16727 Posts

Pinned topic Search Html.BODY Class For Specific String.

‏2012-05-07T19:02:02Z |
I am new to RFT and currently evaluating for my company. I am trying to search a Html.BODY class object for a particular string, but I have not been able to accomplish it.

When I use the .toString method on the name that RFT gave the object, I get the following:

Here are the contents of the Rating Work Sheets: GuiTestObject(Name: html_worksheet, Map: worksheet)

How do I get the contents into a variable so that I can search that variable for a paricular value?

ie.
String AGR = html_worksheet().toString();
logInfo("Here are the contents of the Rating Work Sheets: " + AGR);

if (AGR.indexOf("<some search string>") < 0)
{
<fail test>
}
else
{
<pass test>
}
;
Updated on 2012-05-08T13:37:31Z at 2012-05-08T13:37:31Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    16727 Posts

    Re: Search Html.BODY Class For Specific String.

    ‏2012-05-08T05:11:45Z  
    Can you post whole (relevant) code? How do you get the properties? Did you thy .getProperty() method?

    R.
  • SunilP3
    SunilP3
    1 Post

    Re: Search Html.BODY Class For Specific String.

    ‏2012-05-08T06:54:14Z  
    try following:

    String AGR = html_worksheet().getProperty(".text").toString();
  • SystemAdmin
    SystemAdmin
    16727 Posts

    Re: Search Html.BODY Class For Specific String.

    ‏2012-05-08T07:11:10Z  
    there is many ways to do that, here is the 2 ways I use to do:

    find(atDescendant(".class","Html.BODY","property_to_find","property_value"));

    return a list of TestObject...
    A faster way with "atChild" method but you have to know the arborescence of the DOM :

    TestObject[] browsers = find(atChild(".class","Html.BROWSER"));
    TestObject[] documents = browsers[0].find(atChild(".class","Html.DOCUMENT"));
    TestObject[] bodies = documents[0].find(atChild(".class","Html.BODY","property_to_find","property_value"));
  • SystemAdmin
    SystemAdmin
    16727 Posts

    Re: Search Html.BODY Class For Specific String.

    ‏2012-05-08T13:37:31Z  
    Thank you all for your responses.

    The getproperty method was what I needed.