1

I installed RFT 8.5 and JRE 7. When I run the scripts it's not finding browser object.

Below is the code which I have used in RFt to find the brwoser object.

Dim Allobjects() as TestObeject
Allobjects=RootTestObject.GetRootTestObject.Find(".class","Html.HtmlBrowser"))

Here it's is returning Allbects.lenth=0. Because of the I am getting struck.

Anybody can help me how to resolve this issue.

Note: I am using IE8

Rizvi
  • 287
  • 3
  • 14
Madhu Sudhakar
  • 141
  • 2
  • 6

3 Answers3

1

I was not able to find the browsers using RootTestObject either. But it is possible to find the browser windows using the Html domains:

startApp("Google");
startApp("asdf");
sleep(5);

DomainTestObject[] dtos = getDomains();
List<DomainTestObject> htmlDomains = new ArrayList<DomainTestObject>();
for (DomainTestObject dto : dtos) {
    if (dto.getName().equals("Html")) {
        htmlDomains.add(dto);
    }
}

List<BrowserTestObject> browsers = new ArrayList<BrowserTestObject>();
for (DomainTestObject htmlDomain : htmlDomains) {
    TestObject[] tos = htmlDomain.getTopObjects();
    for (TestObject to : tos) {
        if (to.getProperty(".class").equals("Html.HtmlBrowser")) {
            browsers.add((BrowserTestObject) to);
        }
    }
}

System.out.println("Found " + browsers.size() + " browsers:");
for (BrowserTestObject browser : browsers) {
    System.out.println(browser.getProperty(".documentName"));
}

Output:

Found 2 browsers:
https://www.google.ch/
http://www.asdf.com/

First, I start 2 browsers. Then I get all Html domain test objects. After that, I get all top objects and check whether their class is Html.HtmlBrowser.

I hope there is a simpler solution—looking forward to seeing one :)

Roland
  • 1,220
  • 1
  • 14
  • 29
1

Try the below code Snippet:

 Dim Allobjects() As TestObject
 Allobjects = Find(AtDescendant(".class", "Html.HtmlBrowser"))

Hope it helps.

Archiekins
  • 30
  • 5
0

Browser is a toplevel window so what you can do is : Dim Allobjects() as TestObeject Allobjects=Find(AtChild(".class","Html.HtmlBrowser")) 'The above code expects the browser to be statically enabled , also RootTestObject is not needed as implicitly RFT will use the RootTestObject if no anchor is provided.

Also if the browser is not statically enabled then you could also use:

DynamicEnabler.HookBrowsers() API so that browsers get enabled.

Prakash
  • 742
  • 7
  • 19