Forum Discussion

dhundley's avatar
dhundley
Regular Contributor
9 months ago
Solved

using a variable name with an object data type in a keyword test

Here's what i want to do. someone tell me if it is possible and, if so, how.

 

i want to add a variable(s) to a keyword test that is of the "object" data type. using the FindChild method i want to locate an object in my application and equate the object type variable with that object. Then, in the keyword test, i want to be able to click on it (if it's a button type of object), use the SetText to enter text (if it's a textbox type of object), etc. i know i could do this in a javascript function but i would like to do the operations in the keyword test if possible but it seems like the only thing that I can enter into the Item column of the keyword test workspace are NameMapping objects. can i somehow perform operations on object variables in the keyword test?

 

thanks!

  • I think to achieve this, you will have to use Run Code Snippet operation in your keyword test.

     

    Keyword tests consist of keywords that define the action to be performed by the test. Each keyword corresponds to an individual action like mouse click, selection of a menu item, keystrokes, opening or closing a window and so on. I don't think it will understand what objLookup item is, and the operations to perform on.

4 Replies

    • dhundley's avatar
      dhundley
      Regular Contributor

      the only references to keyword tests that I see in that article are:

       

      Object type variables have global visibility scope and can be used to obtain an object from any keyword test or script unit or to exchange data between tests or units. These variables are available even when a test run is terminated and script variables do not exist.

      The behavior of variables of this type differ from the behavior of variables of ordinary types:

      • The variables can only be assigned from keyword tests or scripts. 

      there's no mention or example of performing an operation on an object type variable in a keyword test. What i would like to know is whether or not it is possible to do something such as this in the workspace area of a keyword test (where objLookup has been defined at the Project level as an "object" data type):

       

      Item                                   Operation                         Value

      Set Variable Value             objLookup [Project]       Aliases.NuPoint.dlgCSINuPoint.btnOK

      objLookup[Project]         ClickButton

       

      Yes or No?

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    I think to achieve this, you will have to use Run Code Snippet operation in your keyword test.

     

    Keyword tests consist of keywords that define the action to be performed by the test. Each keyword corresponds to an individual action like mouse click, selection of a menu item, keystrokes, opening or closing a window and so on. I don't think it will understand what objLookup item is, and the operations to perform on.

    • dhundley's avatar
      dhundley
      Regular Contributor

      That did it! Thank you! Thank you! Thank you!