Web Scrapers Generator BrowserExt

getform

Gets the form's parameters by the given xpath. Valid only inside the loadpage and submitform.

var = getform(xpath[, options]);
    

Parameters:

xpath The string with the xpath expression, defining the node's address.
options Parameters dictionary. May contain the following elements:
html By means of this parameter html code can be passed, then the function will look for form element in this html code but not in the loaded page.

Returned value: the dictionary of form parameters. This dictionary can be used for other functions, such as submitform, formsetparam and others.

If xpath defines several forms, it always returns the first.

var['form'] contains a dictionary with all the attributes of the form element, they are always consist of var['form']['action'] and var['form']['method']. var['params'] contains a dictionary of name => value pairs of the form elements, such as input, select, textarea. var['types'] contains a dictionary of name => type pairs of form elements.

Example 1. We will get form's parameters and output the default values, as well as we set some parameters and submit the form.