public clickLinkById ( string $id ) : string/boolean | ||
$id | string | ID attribute value. |
return | string/boolean |
public function clickLinkById($id)
{
if (!($url = $this->getLinkById($id))) {
return false;
}
$this->load($url, new SimpleGetEncoding());
return $this->getContent();
}
function testIdLinkFollowing() { $browser = new SimpleBrowser(); $browser->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); $browser->get('http://www.lastcraft.com/test/link_confirm.php'); $this->assertTrue($browser->clickLinkById(1)); $this->assertPattern('/target for the SimpleTest/', $browser->getContent()); }