TAGs and HTML

From iMacros
Jump to: navigation, search

This page explains the relation between the HTML source code and the iMacros TAGs that work on that very code. Especially when creating or manually editing iMacros TAGs, basic knowledge on this relation is essential.

HTML basics

All elements in the HTML source code are enclosed by tags. A bold text, e.g. by

<b> and </b> 

a headline by

<h1> and </h1> 

and the whole page by

<html> and </html>

Additionally, some tags may have more attributes, like e.g. a link that does (at least) contain the URL of the page to link to, given by "href=URL"

<a href="newPage.html"> link text </a> 

or a table's cell that may contain information about e.g. the text alignment within that cell:

<td align="right"> cell text </td>

And it is precisely these tag types and attributes that the iMacros TAGs use to identify an HTML item.

TAGs

TYPE

The HTML tag's type is given by the TYPE parameter:

TYPE=B for <b></b>
TYPE=H1 for <h1></h1>
TYPE=HTML for <html> and </html>

ATTR

The additional attributes are given by the ATTR parameter as in

<a href="newPage.html"> link text </a> 

which becomes

TYPE=A ATTR=HREF:newPage.html

or

<td align="right"> cell text </td>

which becomes

TYPE=TD ATTR=ALIGN:right

Combining attributes by &&

In case the HTML tag contains more than one additional attribute, you can add then in the TAG by the "&&" symbols:

<td align="right" bgcolor="blue"> cell text </td>

would match the following

TYPE=TD ATTR=ALIGN:right&&BGCOLOR:blue

Test it in iMacros

At http://demo.imacros.net/html2tag.aspx you can find an example page, where you can see the "conversion" that was explained above:

  • visit http://demo.imacros.net/html2tag.aspx using iMacros
  • record a macro on the presented elements
  • have a look at the macro's source code and compare it to the HTML code (given on this site, too).