Exemplo n.º 1
0
 /**
  *    Follows a link by name.
  *
  *    Will click the first link found with this link text by default, or a
  *    later one if an index is given. Match is case insensitive with
  *    normalized space. The label is translated label. There is an assert
  *    for successful click.
  *    WARNING: Assertion fails on empty ("") output from the clicked link
  *
  *    @param string $label      Text between the anchor tags.
  *    @param integer $index     Link position counting from zero.
  *    @param boolean $reporting Assertions or not
  *    @return boolean/string    Page on success.
  *
  *    @access public
  */
 function clickLink($label, $index = 0)
 {
     $url_before = $this->getUrl();
     $urls = $this->_browser->_page->getUrlsByLabel($label);
     if (count($urls) < $index + 1) {
         $url_target = 'URL NOT FOUND!';
     } else {
         $url_target = $urls[$index]->asString();
     }
     $ret = parent::clickLink(t($label), $index);
     $this->assertTrue($ret, ' [browser] clicked link ' . t($label) . " ({$url_target}) from {$url_before}");
     return $ret;
 }