How do I check if a link exists in a page? There is a form having a link clicking on which field set will be collapsed to show fields under it. HTML is shown as below.

&lt;span class="fieldset-legend"&gt;
  &lt;a href="#" class="fieldset-title"&gt;
    &lt;span class="fieldset-legend-prefix element-invisible"&gt;Hide&lt;/span&gt;
    Attach
  &lt;/a&gt;
&lt;span class="summary"&gt;&lt;/span&gt;&lt;/span&gt;


How would I go about checking if this link exists (to click on it), and the fields under it are shown?
To answer my own question, I realized (even without clicking on the link) that fields can be asserted by DrupalWebTestCase::assertFieldByName().