Forum Discussion

Vallalarasu_P's avatar
Frequent Contributor
5 years ago

Xpath in Keyword Test, How to identify and perform operation on it ?

How to find the object using xpath expression and performing operation on the found object ?
  • tristaanogre's avatar
    5 years ago

    I agree with cunderw .  Unless ABSOLUTELY necessary, you don't need to use XPath expressions to find objects in TestComplete tests.


    IF, however, you need to....


    1) Use "Call Object Method" operation in Keyword test to call the XPath method on your parent object

    2) USe "Set Variable Value" operation to set the "Last Operation Result" to the value of your variable

    3) Use that variable in code expressions and such within your keyword tests to identify your object



    It's point 3 which makes using XPath expressions in keyword tests VERY cumbersome because you can't just use "On screen action"... everything needs to be a code snippet or code expression from that point onwards.  You might as well write in code rather than a keyword test.