WebPageLink Function

Action

Queries the currently active page for the specified HTML hyperlink. If this link is found, the function requests and reads the complete Web page that the link refers to. If the retrieved document is of content type HTML, it is parsed and embedded documents are requested.

There are different possibilities how hyperlinks can be named. These hyperlink identification rules are listed herein, ordered by priority:

  • Content text between the anchor begin and anchor end tag.

    <a href="data2html.asp">Content</a>
  • If the hyperlink is image-based, the “alt” attribute is used and added to the content text between the anchor begin and anchor end tag.

    <a href="data2html.asp"><img alt="BBK" src="p.gif"></a>

In the case of changing hyperlink descriptions, you can refer to the hyperlink by number instead of the description text. All hyperlinks are numbered sequentially throughout the Web page.

Include file

WebAPI.bdh

Syntax

WebPageLink( in sHyperlink : string allownull,
             in sTimer     : string optional,
             in nLinkNo    : number optional,
             in sFrame     : string optional,
             in hContext   : number optional): boolean;

Return value

  • true if the hyperlink is found and the page is downloaded successfully

  • false otherwise

Parameter Description
sHyperlink The name of the hyperlink to search for in the currently active Web page, or if the hContext parameter is not omitted to search for in the specified context. Set this parameter to NULL if a name is not available or if you want to identify the hyperlink only by number.
sTimer Name of the timer used for page measurements (optional). If this parameter is omitted, no measurements are performed.
nLinkNo Number of the hyperlink in the Web page (optional). If sHyperlink is NULL, the function requests the document that the n-th hyperlink in the page refers to. If sHyperlink specifies a name, the function follows the n-th hyperlink with the given name.
sFrame The name of the frame the document is assigned to (optional). If this parameter is provided, the hyperlink is searched only within this frame document.
hContext Context, stored by a prior call of the WebPageStoreContext function, where to search for the link (optional). If this parameter is omitted the link is searched in the actual page and all stored contexts.

Example

dcltrans
  transaction TMain
  var
    hContext: number;
  begin
    WebPageUrl("http://lab3/shopit/", "ShopIt - Greetings");
    WebPageStoreContext(hContext);
    WebPageLink("Join the experience!", "ShopIt - New Visitor");
    WebPageSubmit("Continue", CONTINUE001, "ShopIt - Main menu");
    WebPageLink("Products", "ShopIt - Products");
    WebPageLink(NULL, "ShopIt - Product", 3);
    WebPageLink("Help", "ShopIt - Help", 0, NULL, hContext);
  end TMain;

dclform
  CONTINUE001:
    "name"            := "jack",
    "New-Name-Button" := "Continue";