Simple RFT script to test Google home page

Here is Simple dynamic RFT script which will launch a browser and then opens google home page and enters some thing in the search text box and searches for the same ...
Here is the RFT code to make it work

public void testMain(Object[] args)
    {
        startBrowser("http://google.co.in");
        sleep(25);
        TestObject[] to = getRootTestObject().find(
                atDescendant(".class","Html.INPUT.text",".title","Google Search"));
        // print dialog test object properties to console
        /*for (int i = 0; i < to.length; i++) {
           System.out.println (to[i].getProperties());
        }*/
        GuiTestObject contactLink = new GuiTestObject(to[0]);
        contactLink.click();
        BrowserTestObject b = findBrowser();
        b.inputChars("How to use RFT find method");
        TestObject[] to1 = getRootTestObject().find(
                atDescendant(".class","Html.INPUT.submit",".value","Google Search"));
        GuiTestObject searchButton = new GuiTestObject(to1[0]);
        searchButton.click();
        sleep(20);
        b.close();
    }
    private BrowserTestObject findBrowser(){
        TestObject[] foundTOs = find(atDescendant(".class", "Html.HtmlBrowser"));
        BrowserTestObject browser = (BrowserTestObject) foundTOs[0];
        return browser;
    }
}

0 comments:

Post a Comment

Who ever writes Inappropriate/Vulgar comments to context, generally want to be anonymous …So I hope U r not the one like that?
For lazy logs u can at least use Name/URL option which don’t even require any sign-in, good thing is that it can accept your lovely nick name also and URL is not mandatory too.
Thanks for your patience
~Best job portal admin(I love "Transparency")