Passing object from script to keyword test
Hi,
I wrote a script that returns a grid's cell object. I want to use it in keywords test to perform methods on it.
How to use such object in keyword test?
I created object variable that is set from the script but when I want to use it e.g. in 'Call Object Method' I get message that there is no object or it's unavailable or something like this. When I use this variable in 'Run Code Snippet' it works but I don't want to use that way.
Any ideas/suggestion ?
The answer is: you can't. The object needs to be referenced in some way as to be able to interact with it. So, when your script returns an object, you need to have some way of getting to that object. Assigning it to a variable is the only way I've found to be able to do this and a code snippet is the only way without implementing some other code (another script function for example) to perform the necessary action against it.
Now... if you DO go the way of a custom keyword operation (which is basically writing another script function but encapsulating it), you could pass the retrieved object to that operation using "Last Results" item as I mentioned above. I'd be curious to see what you come up with but, either way, you're going to write script code somewhere... either as a snippet, as a script routine, or as a script extension.
May I ask... why do you want to avoid a code snippet? If it's not broke, don't fix it...