HTMLDocumentFunctions

Last Updated:

Actions for working with HTMLDocument objects


[How To Read This Reference]
CaptureBodySourceToFile
RC RJ SE
Captures the HTML source of the BODY tag into a file.
CaptureBodyTextToFile
RC RJ SE
Captures the visible document text into a file.
ClickLink
RC RJ SE
Performs an HTMLLink Click based on a complete match of text found on Links within this HTMLDOCUMENT object.
ClickLinkBeginning
RC RJ SE
Performs an HTMLLink Click based on a partial match of text found on Links within this HTMLDOCUMENT object.
ClickLinkContaining
RC RJ SE
Performs an HTMLLink Click based on a partial match of text found on Links within this HTMLDOCUMENT object.
ClickLinkMatching
RC SE
Deprecated For:ClickLink
VerifyBodySource
RC RJ SE
Compares the HTML source of the BODY tag with that of a benchmark file.
VerifyBodyText
RC RJ SE
Compares the visible doc text with that of a benchmark file.

HTMLDocumentFunctions::CaptureBodySourceToFile
RC RJ SE

Captures the HTML source of the BODY tag into a file.

Captures the HTML source of the BODY tag into a file.
This includes the BODY tag itself, everything inside it, and the closing /Body tag as well.

RobotJ (RJ) Specific Notes:
1) If your HTML document or browser does not support the 'outerHTML' property then you may have to resort to providing internet connection info in the properties file mentioned in #2.

2) If you use proxy to connect to internet, proxy.server and proxy.server.port in the file org.safs.rational.proxyParameter.properties must be set to ensure the execution of this command.



Fields: [ ]=Optional with Default Value
  1. Filename
    Name of the output file to create in the active "Test" directory.

    Name of the output file to create in the active "Test" directory. This is the name only, no path information is expected. If the file extension is omitted then the default extension of ".TXT" will be used.

  2. [ FileEncoding = ]
    Specify a character encoding to be used when saving data to a file. If it is not specified, the system default file encoding will be used. The encoding should be a valid string supported by Java; if it is not valid, the system default file encoding will be used instead.


Examples:
  • T, WebBrowser, WebPage, CaptureBodySourceTofile, OutputFile
    Stores the text within the BODY tag to OutputFile.TXT

    Field 5 : TQ String. Filename of the output file in the active "Test" directory. If no extension is provided then .TXT is assumed.

  • T, WebBrowser, WebPage, CaptureBodySourceTofile, OutputFile, "UTF-8"
    Stores the text within the BODY tag to OutputFile.TXT

    Field 5 : TQ String. Filename of the output file in the active "Test" directory. If no extension is provided then .TXT is assumed.
    Write the file with "UTF-8" encoding.


[How To Read This Reference]

HTMLDocumentFunctions::CaptureBodyTextToFile
RC RJ SE

Captures the visible document text into a file.

Captures the visible document text into a file.
That is, generally, the text you see with no HTML tags. /Body tag as well.


Fields: [ ]=Optional with Default Value
  1. Filename
    Name of the output file to create in the active "Test" directory.

    Name of the output file to create in the active "Test" directory. This is the name only, no path information is expected. If the file extension is omitted then the default extension of ".TXT" will be used.

  2. [ FileEncoding = ]
    Specify a character encoding to be used when saving data to a file. If it is not specified, the system default file encoding will be used. The encoding should be a valid string supported by Java; if it is not valid, the system default file encoding will be used instead.


Examples:
  • T, WebBrowser, WebPage, CaptureBodyTextTofile, OutputFile
    Stores the visible text to OutputFile.TXT

    Field 5 : TQ String. Filename of the output file in the active "Test" directory. If no extension is provided then .TXT is assumed.

  • T, WebBrowser, WebPage, CaptureBodyTextTofile, OutputFile, "UTF-8"
    Stores the visible text to OutputFile.TXT

    Field 5 : TQ String. Filename of the output file in the active "Test" directory. If no extension is provided then .TXT is assumed.
    Writing file with "UTF-8" encoding.


[How To Read This Reference]

HTMLDocumentFunctions::ClickLink
RC RJ SE

Performs an HTMLLink Click based on a complete match of text found on Links within this HTMLDOCUMENT object.

Performs an HTMLLink Click based on a complete match of text found on Links within this HTMLDOCUMENT object.

Optionally, the user can also specify a match index to indicate that the desired Link is the "nth" Link that matches the text criteria.

The text comparison for the Link is NOT case-sensitive by default.

Leading and trailing whitespace will be removed from the links as they are compared unless the link in the HTML itself is quoted. In addition, any Line Feeds and Carriage Returns will be removed. For the link, we use the outerText property to locate the text.



Fields: [ ]=Optional with Default Value
  1. CompareTextValue
    The text to compare with each Link.

    The text to compare with each Link. By default this comparison is not case-sensitive.

  2. [ MatchIndex = ]
    Optional match index indicating the desired link is not the first link that matches, but the "nth" link that matches.

    Optional match index indicating the desired link is not the first link that matches, but the "nth" link that matches. The index is 1-based. "1" selects the first matching link, "2" selects the second matching link, etc..

  3. [ CaseSensitive = ]
    "Case-Sensitive", "CaseSensitive", or "True" will make search case-sensitive.

    "Case-Sensitive", "CaseSensitive", or "True" will make search case-sensitive.

Examples:
  • T, WebBrowser, WebPage, CLICKLINK, "Yearly Reports"
    Performs a single click on the HTMLLink that contains "Yearly Reports" in the document.

    Field 5 : TQ String. The case-insensitive text to match and click

  • T, WebBrowser, WebPage, CLICKLINK, "Yearly Reports", 1, "CaseSensitive"
    Performs a single click on the HTMLLink that contains "Yearly Reports" in the document.

    Field 5 : The text to match and click
    Field [6]: The first link that matches.
    Field [7]: The search is case-sensitive.


  • T, WebBrowser, WebPage, CLICKLINK, "Yearly Reports", 4
    Performs a single click on the 4th HTMLLink that matches "Yearly Reports" in the document.

    Field 5 : TQ String. The case-insensitive text to match and click
    Field [6]: TQ String. The match index to select if more than one link would match and you don't want the first one


[How To Read This Reference]

HTMLDocumentFunctions::ClickLinkBeginning
RC RJ SE

Performs an HTMLLink Click based on a partial match of text found on Links within this HTMLDOCUMENT object.

Performs an HTMLLink Click based on a partial match of text found on Links within this HTMLDOCUMENT object. The text of the Link is expected to BEGIN with the text provided by the user. Optionally, the user can also specify a match index to indicate that the desired Link is the "nth" Link that matches the text criteria.

The text comparison for the Link is NOT case-sensitive by default. The user can specify a case-senstive comparison via CaseSensitive Field #7.

Leading and trailing whitespace will be removed from the links as they are compared unless the link in the HTML itself is quoted. In addition, any Line Feeds and Carriage Returns will be removed. For the link, we use the outerText property to locate the text.



Fields: [ ]=Optional with Default Value
  1. BeginningTextValue
    The text (NOT case-sensitive) to compare with the beginning of each Link.

    The text (NOT case-sensitive) to compare with the beginning of each Link.

  2. [ MatchIndex = ]
    Optional match index indicating the desired link is not the first link that matches, but the "nth" link that matches.

    Optional match index indicating the desired link is not the first link that matches, but the "nth" link that matches. The index is 1-based. "1" selects the first matching link, "2" selects the second matching link, etc..

  3. [ CaseSensitive = ]
    "Case-Sensitive", "CaseSensitive", or "True" will make search case-sensitive.

    "Case-Sensitive", "CaseSensitive", or "True" will make search case-sensitive.

Examples:
  • T, WebBrowser, WebPage, CLICKLINKBEGINNING, "Report Generated on"
    Performs a single click on HTMLLinks that begin with "Report Generated on" on WebPage document

    Field 5 : TQ String. The case-insensitive text to match and click

  • T, WebBrowser, WebPage, CLICKLINKBEGINNING, "Report Generated on", 4
    Performs a single click on the 4th HTMLLink match beginning with "Report Generated on" on WebPage document

    Field 5 : TQ String. The case-insensitive text to match and click
    Field [6]: TQ String. The match index to select if more than one link would match and you don't want the first one


  • T, WebBrowser, WebPage, CLICKLINKBEGINNING, "Report", 1, ^CaseSensitive="TRUE"
    Performs a single click on the 1st HTMLLink match beginning with "Report" on WebPage document. This time the link text comparison IS case-sensitive.

    Field 5 : TQ String. The text to match and click
    Field [6]: TQ String. The match index to select if more than one link would match and you don't want the first one Field [7]: TQ String. "Case-Sensitive", "CaseSensitive", or "True" to make the match case-sensitive.


[How To Read This Reference]

HTMLDocumentFunctions::ClickLinkContaining
RC RJ SE

Performs an HTMLLink Click based on a partial match of text found on Links within this HTMLDOCUMENT object.

Performs an HTMLLink Click based on a partial match of text found on Links within this HTMLDOCUMENT object. The text of the Link is expected to CONTAIN the text provided by the user at any position in the Link text--not strictly the beginning as in ClickLinkBeginning.

Optionally, the user can also specify a match index to indicate that the desired Link is the "nth" Link that matches the text criteria.

The text comparison for the Link is NOT case-sensitive by default.

Leading and trailing whitespace will be removed from the links as they are compared unless the link in the HTML itself is quoted. In addition, any Line Feeds and Carriage Returns will be removed. For the link, we use the outerText property to locate the text.



Fields: [ ]=Optional with Default Value
  1. CompareTextValue
    The text to compare with each Link.

    The text (NOT case-sensitive) to compare with each Link.

  2. [ MatchIndex = ]
    Optional match index indicating the desired link is not the first link that matches, but the "nth" link that matches.

    Optional match index indicating the desired link is not the first link that matches, but the "nth" link that matches. The index is 1-based. "1" selects the first matching link, "2" selects the second matching link, etc..

  3. [ CaseSensitive = ]
    "Case-Sensitive", "CaseSensitive", or "True" will make search case-sensitive.

    "Case-Sensitive", "CaseSensitive", or "True" will make search case-sensitive.

Examples:
  • T, WebBrowser, WebPage, CLICKLINKCONTAINING, "Yearly Reports"
    Performs a single click on HTMLLinks that contains "Yearly Reports" on WebPage document

    Field 5 : TQ String. The case-insensitive text to match and click

  • T, WebBrowser, WebPage, CLICKLINKCONTAINING, "Yearly Reports", 1, "CaseSensitive"
    Performs a single click on HTMLLinks that contains "Yearly Reports" on WebPage document

    Field 5 : The text to match and click
    Field [6]: The first link that matches.
    Field [7]: The search is case-sensitive.


  • T, WebBrowser, WebPage, CLICKLINKCONTAINING, "Yearly Reports", 4
    Performs a single click on the 4th HTMLLink match that contains "Yearly Reports" on WebPage document

    Field 5 : TQ String. The case-insensitive text to match and click
    Field [6]: TQ String. The match index to select if more than one link would match and you don't want the first one


[How To Read This Reference]

HTMLDocumentFunctions::ClickLinkMatching (deprecated for: ClickLink)
RC SE

DEPARECATED. This command is identical to ClickLink.

DEPARECATED. This command is identical to ClickLink.

Fields: [ ]=Optional with Default Value
  1. CompareTextValue
    The text to compare with each Link.

    The text to compare with each Link. By default this comparison is not case-sensitive.

  2. [ MatchIndex = ]
    Optional match index indicating the desired link is not the first link that matches, but the "nth" link that matches.

    Optional match index indicating the desired link is not the first link that matches, but the "nth" link that matches. The index is 1-based. "1" selects the first matching link, "2" selects the second matching link, etc..

  3. [ CaseSensitive = ]
    "Case-Sensitive", "CaseSensitive", or "True" will make search case-sensitive.

    "Case-Sensitive", "CaseSensitive", or "True" will make search case-sensitive.

Examples:
  • T, WebBrowser, WebPage, ClickLinkMatching, "Yearly Reports"
    Performs a single click on the HTMLLink that contains "Yearly Reports" in the document.

    Field 5 : TQ String. The case-insensitive text to match and click

  • T, WebBrowser, WebPage, ClickLinkMatching, "Yearly Reports", 1, "CaseSensitive"
    Performs a single click on the HTMLLink that contains "Yearly Reports" in the document.

    Field 5 : The text to match and click
    Field [6]: The first link that matches.
    Field [7]: The search is case-sensitive.


  • T, WebBrowser, WebPage, ClickLinkMatching, "Yearly Reports", 4
    Performs a single click on the 4th HTMLLink that matches "Yearly Reports" in the document.

    Field 5 : TQ String. The case-insensitive text to match and click
    Field [6]: TQ String. The match index to select if more than one link would match and you don't want the first one


[How To Read This Reference]

HTMLDocumentFunctions::VerifyBodySource
RC RJ SE

Compares the HTML source of the BODY tag with that of a benchmark file.

This includes the BODY tag itself, everything inside it, and the closing /Body tag as well.

RRAFS:
The routine will automatically create a temporary ObjectData VP with a dummy baseline, capture the actual file, transfer it to active "Test" directory, and compare it with the benchmark. The routine will then delete all significant remnants of the temporary ObjectData VP.

RRAFS:
This routine requires that the following two files exist in the DDE_RUNTIME directory:

HTMLDocumentHTML.grd
HTMLDocumentHTML.vpm

The command may produce a WARNING if a diff tool for which we have no means to verify the results is configured for use. Consequently, if these warnings are expected, the user can use the "TW" test record type to avoid issuing these warnings.

RobotJ (RJ) Specific Notes:
1) If you use proxy to connect to internet, proxy.server and proxy.server.port in the file org.safs.rational.proxyParameter.properties must be set to ensure the execution of this command.



Fields: [ ]=Optional with Default Value
  1. Benchmark
    Name of the benchmark file in the active "Bench" directory to use for the actual test file comparison.

    Name of the benchmark file in the active "Bench" directory to use for the actual test file comparison. This is the name only, no path information is expected. If the file extension is omitted then the default extension of ".TXT" will be used.

  2. [ FileEncoding = ]
    Specify a character encoding to be used when opening a bench file. If it is not specified, the system default file encoding will be used. The encoding should be a valid string supported by Java; if it is not valid, the system default file encoding will be used instead.


Examples:
  • T, WebBrowser, WebPage, VERIFYBODYSOURCE, BenchmarkFile.TXT
    Performs action compares the text within the BODY tag to the BenchmarkFile.TXT

    Field 5 : TQ String. Filename of the Benchmark file in the active "Bench" directory. If no extension is provided then .TXT is assumed.

  • T, WebBrowser, WebPage, VERIFYBODYSOURCE, BenchmarkFile.TXT, "UTF-8"
    Performs action compares the text within the BODY tag to the BenchmarkFile.TXT

    Field 5 : TQ String. Filename of the Benchmark file in the active "Bench" directory. If no extension is provided then .TXT is assumed.
    Opening the bench file with "UTF-8" encoding.


[How To Read This Reference]

HTMLDocumentFunctions::VerifyBodyText
RC RJ SE

Compares the visible doc text with that of a benchmark file.

The routine will automatically create a temporary ObjectData VP with a dummy baseline, capture the actual file, transfer it to active "Test" directory, and compare it with the benchmark. The routine will then delete all significant remnants of the temporary ObjectData VP.

This routine requires that the following two files exist in the DDE_RUNTIME directory:

HTMLDocumentText.grd HTMLDocumentText.vpm

The command may produce a WARNING if a diff tool for which we have no means to verify the results is configured for use. Consequently, if these warnings are expected, the user can use the "TW" test record type to avoid issuing these warnings.



Fields: [ ]=Optional with Default Value
  1. Benchmark
    Name of the benchmark file in the active "Bench" directory to use for the actual test file comparison.

    Name of the benchmark file in the active "Bench" directory to use for the actual test file comparison. This is the name only, no path information is expected. If the file extension is omitted then the default extension of ".TXT" will be used.

  2. [ FileEncoding = ]
    Specify a character encoding to be used when opening a bench file. If it is not specified, the system default file encoding will be used. The encoding should be a valid string supported by Java; if it is not valid, the system default file encoding will be used instead.


Examples:
  • T, WebBrowser, WebPage, VERIFYBODYTEXT, BenchmarkFile.TXT
    Performs action compares text to the BenchmarkFile.TXT

    Field 5 : TQ String. Filename of the Benchmark file in the active "Bench" directory. If no extension is provided then .TXT is assumed.

  • T, WebBrowser, WebPage, VERIFYBODYTEXT, BenchmarkFile.TXT, "UTF-8"
    Performs action compares text to the BenchmarkFile.TXT

    Field 5 : TQ String. Filename of the Benchmark file in the active "Bench" directory. If no extension is provided then .TXT is assumed.
    Opening the bench file with "UTF-8" encoding.


[How To Read This Reference]