0

I try to get all elements with recognition properties Html.LI and click in every testobjects.

            RootTestObject rto = getRootTestObject();
    TestObject[] objects = rto.find(atDescendant(".class", "Html.LI"));
    for (int i = 0; i <  objects.length; i++) {
        GuiTestObject gui1 = new GuiTestObject ();
         gui1 = (GuiTestObject)  objects[i];
         gui1.hasFocus();
             gui1.click();

        }
}

When I get objects[0] and click on it, page reloads. When I try to click to objects[1], error message CRFCP0050E: No screen point found for object.]

Do you have any idea how to work around?

Sviatlana
  • 11
  • 1

2 Answers2

3

After clicking the objects[0] as the page reloads the testobject references that were returned by the previous call to find() would not be valid anymore.
Before clicking on the objects[1] try to run another find() and see if you are able to perform the click that way.

Prakash
  • 742
  • 7
  • 19
  • In a [developerWorks article](http://www.ibm.com/developerworks/rational/library/06/0711_nowacki_nodwell/) it is recommended to always call `find()` before using an object and never depend on stored objects. – Roland Oct 23 '14 at 08:16
-1

the objects.length contains all objects it found. objects.length = 3

Remember that an array is base [0], [0, 1, 2]

so, if you modify your loop as: for (int i = 0; i < objects.length - 1; i++)

Your code might work.

Regards

Alfonso Flores

  • Since the check is `i < object.length` you don't need to subtract 1—`i` will never reach the value of `object.length`. Your suggestion could be correct if the check was `i <= object.length`. But since the problem is not an ArrayIndexOutOfBoundsException it is unlikely a problem with array indices. – Roland Oct 23 '14 at 06:54