Task Builder Help Globe Icon

Add Navigation Script: Inputs

Use input script to set the necessary values in the required host fields to enable navigation.

You set input values using the IQAScreen interface and, if needed, retrieve values from the task data collection using the ITaskData interface. The Usage Tips, located on the top pane of the editor, provide the variable names that are available to you and link you to the Javadocs for more information on the objects the variables represent.

Step inputs, configured prior to scripting inputs, are no longer visible in the designer. The navigation engine will not set these step inputs as long as the input phase is scripted. If you disable or delete the inputs script, then the original step inputs will again be available.

The following code snippet illustrates putting the string "sample" in HostField7 and putting the string in the task data collection referenced by the variable "Var1" in HostField10:

	try 
	{
		//setting the text "sample" on HostField7
		qaScreen.getField(6).setText("sample");
	}
	catch(ProtectedFieldException pfe)
	{
		//log an error event indicating that setting text on the field failed
		system.logErrorEvent("Got a ProtectedFieldException when trying to set text on HostField7");
		throw new UserScriptException("Cannot set text on HostField7 because it is protected");
	}
	String strVar1 = taskData.get("Var1");
	if (strVar1 == null)
	{
		//log a warning event 
		system.logWarningEvent("The variable Var1 was not found in the task data collection:"); 
	}
	else
	{
		try 
		{
			//setting the text in Var1 on HostField10
			qaScreen.getField(9).setText(strVar1);
		}
		catch(ProtectedFieldException pfe)
		{
			//log an error event indicating that setting text on the field failed
			system.logErrorEvent("Got a ProtectedFieldException when trying to set text on HostField10");
			throw new UserScriptException("Cannot set text on HostField10 because it is protected");
		} 
	}

Disable the Above Script in Step Execution:   Select this option to save your script, but make it unavailable to your task. With this option selected the scripting field is disabled and you cannot edit your script.

Verify Script:   Click this option to verify your script. This will not save changes. If the verification is successful, a message displays in the top pane of the editor. If the verification produces errors, they must be either corrected or the script disabled before you can save the script and proceed with implementing task execution.
Related Topics
Bullet Adding Scripts to Task Steps
Bullet Using Scripts to Replace Portions of Task Steps, Overview
Bullet Task Builder for Screens Help Links
  Footer