Exemplo n.º 1
0
      </span></div>
    </form>

    <form action="/myform5">
      <div><span>
        <button  id="submit5">Click</button>
        <input type="image" src="myimage.png" alt="image submit" name="submit_image" value="image" />
      </span></div>
    </form>

    <a href="/myotherlink">test link</a>

  </body>
</html>
EOF;
$b = new myClickBrowser();
$b->setHtml($html);
try {
    $b->click('nonexistantname');
    $t->fail('->click() throws an error if the name does not exist');
} catch (Exception $e) {
    $t->pass('->click() throws an error if the name does not exist');
}
try {
    list($method, $uri, $parameters) = $b->click('submit5');
    $t->pass('->click() clicks on button links');
} catch (Exception $e) {
    $t->fail('->click() clicks on button links');
}
list($method, $uri, $parameters) = $b->click('test link');
$t->is($uri, '/mylink', '->click() clicks on links');