

The syntax of the matching functionality is inspired by the filter
function in the Mutt mailclient. A list of arguments can be given as
search criteria. When an argument is the "~" followed by a single
character it acts as modifier that determines in which data field the
following argument has to match. There is always a default data field.

So e.g. a hyperlink has the data fields content (the text between the
<a>...</a> tags), url (the href attribute) and full (the full html
source of that link). content is the default data field, so you can
search for a link that contains some text like that:

link find "sometext"

If you are looking for a specific url add the ~u modifier:

link find ~u "/some/url"

Several search criteria are automatically concatenated with AND. So
you can search for:

link find "sometext" ~u "/some/url" "someothertext" ~f "<a[^>]+class=\"?someclass\"?[^>]>"

All those attributes have to match - the link must contain "sometext"
AND "someothertext" in its text, point to the specified url AND must
have a class attribute. Note that e.g. the class attribute is not
parsed in a specified data field, so it has to be retrieved by
searching the full html source of the field (but at least its possible
to search for it at all).

Search criterias can contain a "!" to specify that the following
argument must NOT match. "!" can optionally be prepended or followed
by a "~" modifier. For example:

link find "sometext" ! ~u "/but/not/this/url"

The matching will always be done with "regexp -nocase". I wonder if
case sensitive matching will ever be necessary for website
testing. See the proc find_in_array_list for the matching
implementation.



Searchable items currently are forms, fields and links.

All those items (TODO should) have a find operation. Currently search
arguments are appended at the end of the command and get parsed into
the args parameter of the proc. This allows for the maybe more
convenient syntax:

link find "some text with spaces" ~u "/some/url"

as opposed to putting everything in a seperate list:

link find { "some text with spaces" ~u "/some/url" }





All items and their searchable data fields and the corresponding
modifiers:

link:
~c content (default)
~u url
~f full


form:
~c content (default) means all visible text in this form
~a action
~m method
~n name
~f full


field
~c caption (default)
~t type (can be: text, textarea, password, hidden, radio,
              checkbox, select or submit)
~n name
~v value
~f full


