Web Forms

<< <%SKIN-STRTRANS-SYNTOC%> >>

Navigation:  Agent Commands >

Web Forms

Content Grabber can submit web forms repeatedly - for any combination of input values. You can specify input values as a static list of values, or you can feed the values from an input data source - such as a database or a CSV file.

 

Remember, you can use Set Form Field commands to set form fields, and Navigate Link commands to submit web forms. Some web forms don't have a separate Submit button, but instead submit the form when a form field value changes. We recommend that you use a Navigate Link command in such cases. Set Form Field commands perform actions, such as loading a new web page.

 

The figure below depicts an example configuration for an agent that submits a web form:

 

webFormsAgent

 

Typically, Set Form Field commands that submit a web form are nested. So, if the first command is iterating through a list of input values, then all succeeding Set Form Field commands will execute once for each input value. The last command in a web form configuration is typically a Navigate Link command, and since it's nested along with all the preceding Set Form Field commands, it executes once for each combination of input values.

 

File Download

You can use a web form to download a file, such as an Excel or PDF file. The file download may start when you click the form Submit button, or it may start when you change a form field value.

 

If a file download starts when you click a Submit button, you should use a Download Document command instead of a Navigate Link command. The Download Document command should select the Submit button and have the File Download Action property set to Click to Download.

 

If a file download starts when you change a form field value, you should use a Download Document command instead of a Navigate Link command. Also, the Form Field command that triggers the document download most have the option Download Document command set to the Download Document. The Download Document command must be a direct sub-command of the Form Field command that triggers the file download.

 

Uploading File

Some web forms contain file upload boxes that allow users to upload files to a website. Scripting cannot modify file upload boxes, so it's necessary to process these differently than other web form input boxes.

 

Content Grabber will automatically detect file upload form fields and will try to handle the file upload dialog box that appears when clicking on the file upload form field. For the Set Form Field command that handles the file upload form field, the input value should be the full local file path to the file you want to upload.

 

When the file upload dialog box appears, Content Grabber will automatically enter the file path and click on the button that selects the file. This happens so fast that the dialog box won't appear. Content Grabber needs to click on the button that selects the file, and it does that by looking for a button having an "Open" label. This is the correct button for English language versions of Windows, but will not be the correct button for other language versions of Windows. In such cases, you may need to change the Set Form Field command property Handle Web Browser Dialog. The default value is &OPEN, which means that the agent will be looking for the text "Open" on the dialog button. The text &O is shown as O and means the button can be activated by pressed the keyboard combination ALT + O.

 

Website Login Forms

Content Grabber can process website login forms the same way it handles any other web forms. An agent that processes a login web form would normally have a Set Form Field command for the Username, and another Set Form Field command for the Password, and a Navigate Link command that clicks on the login Submit button.

 

webFormLogin

 

Basic Windows Authentication

Some websites use basic Windows authentication, and they will display a Windows login box. Content Grabber gives you the ability to set the Username and Password for basic Windows authentication by editing the Agent Command and then setting the Username and Password in the Basic Windows Authentication of the properties tab.

 

After setting the basic Windows authentication properties, you must reload your agent for the properties to take effect. Basic Windows authentication does not work for in HTML Parsers, JSON Parsers and XML Parsers.