Webtest WebTest GitHub Home

Core Step verifyLinks

Description

This step checks the validity of all links on the current page. Non-HTML pages (CSS, JavaScript, XML files) are not checked for internal links. Non-HTTP links (mail addresses, ftp etc.) are not checked or followed.

You can use this test recursively, so you can also check the links on the pages, which are linked on the current page and so on. For this reason, you can specify the depth parameter.

To avoid scanning sub-links on other hosts, you can set the onsiteonly parameter. If it is set to "true", only the first link on a foreign host is checked for validity.

Parameters

depth
Required? no, default is 0
The depth parameter defines the depth of the recursive search for broken links on sub-pages.
description
Required? no
The description of this test step.
excludes
Required? no, default is <empty>
If excludes is set then each link found is compared to the defined string (via regexp), if it matches then the link is not followed.
ignoreForeignJSErrors
Required? no, default is false
Indicates if JavaScript errors should be ignored on visited pages from a different host than the current page.
includes
Required? no, default is <all>
If includes is set then each link found is compared to the defined string (via regexp), if it matches then the link is processed, others are ignored.
onsiteonly
Required? no, default is false
If onsiteonly is set to true, the recursive search for invalid links is limited to the local host. Only the initial link to a foreign host is checked, but no deeper search is performed.

Details

Don't forget invoke before verification
<webtest name="Check all links on current page">
  <config ... />
  <steps>
    <invoke ... />
    <verifyLinks description="Check Links"/>
  </steps>
</webtest>
<webtest name="Check all links on current page, on subpages and on their subpages">
  <config ... />
  <steps>
    <invoke ... />
    <verifyLinks description="Check Links
      depth="2"/>
  </steps>
</webtest>
<webtest name="Check all links on current page and on subpages except on foreign hosts">
  <config ... />
  <steps>
    <invoke ... />
    <verifyLinks description="Check Links
      depth="1
      onsiteonly="true"/>
  </steps>
</webtest>