Hi Lukas,
Unfortunately, you can specify only constant values as property names and values on the Specify Search Criteria page of the Find Object keyword operation's wizard. Currently, there is no way to use variables to specify property names and values in this operation. However, we have such a user interest registered in our database, and your request has increased its rating. Thank you for the question.
Currently, there is a workaround. You can use a combination of other keyword test operations:
On-Screen Action,
Set Variable Value and
Run Code Snippet. For this purpose, please follow the steps below:
1. Add an On-Screen Action operation. In the wizard with the operation's properties, specify the following settings:
a. on the Select Object page, specify the needed object in which you are going to search for a child object.
b. on the Specify Method or Property page, select the FindChild method.
c. on the Operation Parameters page, specify the property names and values which you want to use as search criteria. In the PropNames parameter, specify an array of the property names. In the PropValues parameter, specify an array of the appropriate property values. If you are going to use only one object property as a search criterion, and you need to use a variable holding the needed property name or value, you can choose the Variable mode for these parameters and specify the needed variable names. If you are going to use several object properties as a search criterion, you need to choose the Code Expression parameter mode and specify the needed variable names separated by commas. Note that you need to specify fully qualified variable names like this:
KeywordTests.Test1.Variables.PropertyValue1, Project.Variables.PropertyValue2
In the Depth parameter of the FindChild method, specify the maximum level of the child objects where FindChild will search for the object that corresponds to the specified criteria.
2. Add the Set Variable Value operation after the above-mentioned On-Screen Action operation in your test. In the operation's parameters, specify the variable in which the object found by the On-Screen Action operation will be stored. As the new value to be assigned to the variable, specify
Last Operation Result.
3. Add the Run Code Snippet operation to your test. In its parameters, specify a scripting code snippet that will call the needed method from the object found and stored to the appropriate variable. For example:
KeywordTests.Test1.Variables.FindObjectVar.Click()
Also, you can achieve the same results by using only one Run Code Snippet operation (without the On-Screen Action and Set Variable Value operations). In this case, you need to specify a more complex code snippet that will find the needed object and call the needed method from it. Note that in this case, you need to create an array with the needed variable names (if you use several variables) and pass it through the FindObject method's parameters. For example:
I hope this workaround helps you.