public function clickSubmit($label = 'Submit', $additional = false) { if (!($form = $this->page->getFormBySubmit(new SelectByLabel($label)))) { return false; } $success = $this->load($form->getAction(), $form->submitButton(new SelectByLabel($label), $additional)); return $success ? $this->getContent() : $success; }
function testSimpleSubmit() { $browser = new SimpleBrowser(); $browser->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); $browser->get('http://www.lastcraft.com/test/form.html'); $this->assertTrue($browser->clickSubmit('Go!')); $this->assertPattern('/Request method.*?<dd>POST<\\/dd>/', $browser->getContent()); $this->assertPattern('/go=\\[Go!\\]/', $browser->getContent()); }