How to use a Data List Command to load inputs URLs using Scripts
Steps to create an agent using a script to Load input urls in the Input parameters in the Data List Command
Where to use Input Parameter?
In Sequentum Cloud, navigate to the Agent Configuration >> Input Parameters section within the agent editor. Upload the CSV or Text file to Agent Configuration >> Files make it accessible for your agent
How to create an Input Parameter file to load multiple URLs?
Please prepare a CSV file or Text file with each URL listed in a separate row to ensure the agent can process them correctly
How to configure the URL command to load the URLs?
In the agent editor, Use the "URL" command to access the URLs from your uploaded CSV file by using the "Data list" command.
Sequentum Cloud enables users to create agents that can efficiently handle multiple URLs by using an Input Parameter. In this guide, we’ll walk through the steps to create an agent in Sequentum Cloud that uses an Input Parameter to load and process multiple URLs through the scripts.
Where to upload this file?
Step 1: Open the editor window and navigate to the Agent Configuration → Option → Input Parameters
Here you can enter the file name that you want to call in the script and value in to the Data list command
Step 2: Open the editor window and navigate to the Agent Configuration → Option → Files
Here you can upload the files that can be accessed further through the scripts in the Data list command
Click on the 'Upload File' option to begin the upload process. In the above given example, we are uploading the csv file and text file
Step 3: After uploading the file, click on the 'Extract' icon as shown below to proceed. This will open a list of commands
Step 4: Next, select the 'Data List' command as shown below…
Step 5: After adding the 'Data List' command, navigate to the 'List' option.
Step 6 : Select 'Data Type' as CSV from the dropdown, then choose 'Data Source' as 'Script.' Once 'Script' is selected, choose the coding language for your script. In this example, we select C# as the language. Below is the code to retrieve the input file.
#r System.IO.dll
using System.IO;
public string GetData(RunContext context)
{
var filename = context.GlobalData.GetString("File");
var filepath = context.PrivateFiles.GetFile(filename);
var inputfile = File.ReadAllText(filepath);
return inputfile;
}
Note:
There is a 'Test Script' option available to check if the script is functioning correctly.
How to configure the URL command to load the URLs?
Step 7 : In the Browser group command, click on the 'URL' command and add it under the 'Data List' command.
Step 8: After adding the 'URL' command, navigate to the 'URL' option and select 'Data List' from the ‘URL’ dropdown menu.
After selecting the 'Data List' command, the input will be displayed as shown below:
Note:
Additionally, you can generate the agent in text format by clicking on the 'Text' option in the right panel, as shown below.
This text format can be saved locally by clicking the option available at the bottom.
Agent:
Parameters:
file: Test.txt
Proxies:
Run Without Proxies: true
Commands: Data List
CSV:
Source: Script
@Script: Data List Script
Language: C#
Timeout: 5
Commands: URL
Dynamic Load:
Timeouts:
Discover Activity: 1
Input:
Command: Data List
Data Field:
Transform:>
match (.*)
return ${1}
Commands: Content
Name: City Name
Extract: //span[@class='mw-page-title-main']
Export:
Commands: CSV
Text: Data List Script
>#r System.IO.dll
using System.IO;
public string GetData(RunContext context)
{
var filename = context.GlobalData.GetString("File");
var filepath = context.PrivateFiles.GetFile(filename);
var inputfile = File.ReadAllText(filepath);
return inputfile;
}