I want to change the way my workflow goes by running it as a script in the Evaluate Snippet Command. I'm trying to run the "Run Task" command, but I see that in order to call the method Task RunCommand(object sender), it takes an instance of IAutomationEngineInstance. I tried creating this object, but when the workflow runs, nothing happens, so I'm guessing that whatever that object is, it needs to come from the project itself. How do I get the currently running IAutomationEngineInstance to call the RunCommand method in the SeleniumNavigateToURLCommand class? Or am I looking at this the wrong way? Any help is greatly appreciated. Thanks.
This forum has 172 topics, 459 replies, and was last updated 2 hours ago by Poornima Malv
Thanks for clarifying the scenario. Users do not have access to the engine object, calling a child script from the Evaluate Snippet command won't be possible since Run Task is too complex to work without an engine instance.
However, based on the scenario described, the Run Task command can be used to accomplish the wanted task by formatting your script as follows:
If (condition) Run Task 1 Else If Run Task 2 Else Run Task 3
In Studio v1.5.2 and forward, the If Command allows you to write any conditional logic in the If Condition field, as long as the Condition Option is set to "Inline" and the overall statement results in a true or false return value.
Another option, is to use the Evaluate Snippet command to write the condition and set the value to a boolean variable. Then, this boolean can be used as input for the If Command.
Not quite. What I want to do is figure out how to programmatically call a child script using C#. My idea was to create snippets that have some conditional logic and call the correct child scripts. In other words, I want to be able to call a child script without using the Run Task command, instead calling it directly with code from my Evaluate Snippet task.
from what I understood, you are trying to modularize your project by invoking child scripts from Main. Is this correct? If that is the case, you should use the Run Task command and indicate the file path to the child script. If the child script contains arguments, it will ask for the variable or value to pass in, out or in/out of the child script.
Let me know is this answers your question, or please provide more information so we can better assist you.
You are not authorized to reply, please click here to login and add your reply to this topic.