Topic
  • 2 replies
  • Latest Post - ‏2013-09-04T22:17:25Z by Y5QY_gerben_delange
java_rb999
java_rb999
5 Posts

Pinned topic how to get the title of the webpage in RFT

‏2013-08-28T12:09:13Z |

Hi,

I am currently trying to automate a web application using RFT.The web application is written in Java.

My test case,the moment,I navigate to a particular page,I want to get the title of the webpage

example:- you go to www.google.com and then click on 'News'. The page title is "Google News".

I want to get this title.

Like in Selenium,I am aware that  getTitle() used to give me the Title of the page

Please help!

 

Thanks!

 

 

  • MrCoolK
    MrCoolK
    81 Posts

    Re: how to get the title of the webpage in RFT

    ‏2013-08-29T12:02:53Z  

    hi,

        System.out.println(    someObjectInsideTheGooglePage().getTopMappableParent().getProperty(".text"));
          

     

    What I have done is captured a object inside googgle .com and said get me the .text or .name  of top level object that will be the tittle i.e google

     

    Thanks

     

  • Y5QY_gerben_delange
    Y5QY_gerben_delange
    34 Posts

    Re: how to get the title of the webpage in RFT

    ‏2013-09-04T22:17:25Z  
    • MrCoolK
    • ‏2013-08-29T12:02:53Z

    hi,

        System.out.println(    someObjectInsideTheGooglePage().getTopMappableParent().getProperty(".text"));
          

     

    What I have done is captured a object inside googgle .com and said get me the .text or .name  of top level object that will be the tittle i.e google

     

    Thanks

     

    this wil do the trick if you're using internet explorer; will get u titles of all opened html documents

     

    TestObject[] iefr = getRootTestObject().find(
    atDescendant(".class", "IEFrame"));
    for (int i = 0; i < iefr.length; i++) {
    System.out.println(iefr[i].getProperty(".name"));
    }

    you might want to finetune this a little bit because using roottestobject as the startingpoint for a search performes poorly (i suggest using html domaintestobjects instead)

     

    good luck