/** * @param $text * @param bool $exactOnly * @return PHPUnit_Extensions_Selenium2TestCase_Element * @throws Exception */ public function byLinkText($text, $exactOnly = false) { try { return parent::byLinkText($text); } catch (Exception $e) { try { return parent::byLinkText(strtoupper($text)); } catch (Exception $e) { $aTags = $this->findElementsByCssSelector('a'); foreach ($aTags as $aTag) { $aText = $aTag->text(); if (strtolower($aText) == strtolower($text)) { return $aTag; } if (stripos($aText, $text) !== false) { return $aTag; } } } throw $e; } }