Search code examples
testingui-automationqtphp-uft

How reliable is it to use abs_x / abs_y or x/y(relative) for WebElement recognition with QTP/UFT?


I am trying to write a function to recognize a webelement which has following identification properties:

  1. class
  2. innertext
  3. innerHTML
  4. abs_x and abs_y
  5. x and y (relative)

Issue is, the value for "class" keeps changing with different application updates so it can't be used for recognition.

Now, I have option to use absx/absy or x/y. I believe x/y would be better. How reliable is it?


Solution

  • No way!! You should not use any coordinates as properties to find an element!! It will not be reliable at all. Also, if you to try to run the script in another machine with different resolution, it might not work as well.

    Go with 'innertext' & class name. If the class name keeps changing, does it have any pattern like class1, class2 ..etc. if yes, you can use Regular Expression. Worst case, you can use Ordinal identifiers.

    I would never consider coordinates in my test!!