acs::test::find_link (public)

 acs::test::find_link -last_request last_request [ -user_id user_id ] \
    [ -base base ] [ -label label ]

Defined in packages/acs-automated-testing/tcl/aa-test-procs.tcl

Find the first link based on the provided label and return the href.

Switches:
-last_request (required)
-user_id (optional, defaults to "0")
-base (optional, defaults to "/")
-label (optional)
Author:
Gustaf Neumann

Partial Call Graph (max 5 caller/called nodes):
%3 test_fs_add_file_to_folder fs_add_file_to_folder (test file-storage) acs::test::find_link acs::test::find_link test_fs_add_file_to_folder->acs::test::find_link aa_true aa_true (public) acs::test::find_link->aa_true acs::test::detail_link acs::test::detail_link (private) acs::test::find_link->acs::test::detail_link acs::test::dom_html acs::test::dom_html (public) acs::test::find_link->acs::test::dom_html acs::test::follow_link acs::test::follow_link (public) acs::test::follow_link->acs::test::find_link

Testcases:
fs_add_file_to_folder
Source code:
        set href ""
        set html [dict get $last_request body]
        acs::test::dom_html root $html {
            foreach a [$root selectNodes //a] {
                set link_label [string trim [$a text]]
                if {$label eq $link_label} {
                    set href [$a getAttribute href]
                    break
                }
                #
                # There is something weird in tDOM: without the
                # "string trim" we see something like
                #
                #       a TEXT 'DD25C9878' = 'DD25C9878' eq 0 77 9
                #
                # from the statements below.
                # set eq [expr {$label eq $link_label}]
                # aa_log "a TEXT '$link_label' = '$label' eq $eq [string length $link_label] [string length $label]"
                # aa_log "a TEXT '[$a asHTML]'"
            }
        }
        aa_true "href '$href' of link with label '$label' is not empty (<a href='[detail_link $last_request]'>Details</a>)"  {$href ne ""}
        if {![string match "/*" $href]} {
            set href $base/$href
        }
        return $href
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: