TAG
Top  Previous  Next

TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:TestForm2 ATTR=NAME:Name CONTENT=Tom<SP>Tester

The TAG command:
Syntax: TAG POS=<occurence> TYPE=<Type of HTML element> FORM=<Form name> ATTR=<Identifier of element> CONTENT=<Content>
Example: This line fills the first (POS=1) INPUT field with the field entitled "name" with the text "Tom Tester".

Sometimes a web page has several elements with the same name, for example two password fields to confirm a password. The POS parameter indicates which occurrence of the element should be filled or clicked. POS=1 is used by default and means that the first (or only) occurrence of an element is used, POS=2 means, the SECOND occurrence of an element is used. If there are multiple occurrences of an element, IIM does not set the POS parameter automatically. You need to edit the POS parameter manually. Tip:POS={{!LOOP}} allows you to loop through all occurrences of an element. Often this is used to download/extract a series of images from a web page, i.e. to loop through all download links. For more details, please see the "DEMO-TAGPOSITION" example macro.

Sometimes a web page can contain links with the same text, e g. many links with the name "Download". This command tells IIM, to not use the first link it finds, but - for example - the 3rd link. When combined with the !LOOP variable it can be used to process on link after the other.

Special TAG commands for TYPE=SELECT:

By default, the CONTENT attribute of TYPE=SELECT stores the position (also called index) of value. But you can manually edit this to select ALL values of a multiple selection box. Also, to select the values by name add "$" before the name).

To select an entry by its value, use the percent symbol (%).

Spaces must be written as <SP>. The comparison is case insensitive and wild cards like "*" can be used.

Example:
1.CONTENT=2:4 <= Normal selection (the position of a value is stored)  
2.CONTENT=$Apple<SP>Pie:$Fruits <= Selection by name (add $ before the name)  
3.CONTENT=$*apple*:$FRU*" <= Selection by name (wild cards, case insensitive comparison)  
4.CONTENT=%NY <= Selection of a state by value instead of using the name "New York". On the website HTML, such a value typically looks like "<option value="NY">New York</option>"  
5.CONTENT=ALL <= select ALL values of a selection. Useful if the number of values changes dynamically  

Note: If you start the macro via iimPlay and select a value that is NOT in the selection, the iimPlay command returns an error code that is the maximum number of lines possible.

Special TAG commands for non-input fields (like the types A (link), B(bold) or IMG (image)):

Instead of a click on the element you can also ask IIM to fire other events, for example trigger a "mouseover" event to display a menu item. To do this, add a CONTENT attribute to the TAG line. Often these events are used to trigger Javascript menu items.
Example:
TAG POS=1 TYPE=IMG ATTR=HREF:http://www.iopus.com/images/menu1.gif CONTENT=EVENT:#MOUSEOVER


TYPE=FILE:
Internet Explorer and any other browser does not allow automatic fill any fields with the type "file". Typically these fields are used for uploading files. However, iMacros can work around this limitation with the WINCLICK statement. More details can be found in the "Demo-FileUpload" macro.

TYPE=INPUT:HIDDEN: Hidden fields are not displayed in the browser, so the TAG lines for them can not be generated during normal recordeding. But you can add TAG lines with type "HIDDEN" manually into the macro and IIM will fill these hidden fields during replay. Example: "TAG POS=1 TYPE=HIDDEN ATTR=...". For more details please see the "how to".

And here is how to create a TAG line for a hidden (input) field:

1. If your HTML code looks like <input type="hidden" name="testhid"/> then change it temporarily to <input type="input" name="testhid"/>.

2. Now you can record the data entry with iMacros! You will get a macro with a TAG line that reads:
"TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:testform ATTR=NAME:testhid CONTENT= Hello"

3. Change this line manually to:
TAG POS=1 TYPE=INPUT:HIDDEN FORM=NAME:testform ATTR=NAME:testhid CONTENT= Hello





Page URL http://www.iopus.com/imacros/help/tag.htm