SimpleBrowser::clickSubmit PHP Method

clickSubmit() public method

Clicks the submit button by label. The owning form will be submitted by this.
public clickSubmit ( string $label = 'Submit', hash $additional = false ) : string/boolean
$label string Button label. An unlabeled button can be triggered by 'Submit'.
$additional hash Additional form data.
return string/boolean
    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;
    }

Usage Example

コード例 #1
0
 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());
 }
All Usage Examples Of SimpleBrowser::clickSubmit