getCrawler() public method

The returned DOM crawler is bound to the response of the last executed request.
public getCrawler ( ) : Crawler
return Symfony\Component\DomCrawler\Crawler
Example #1
0
 /**
  * Go to the previous form page
  *
  * @param \Symfony\Component\DomCrawler\Form $form
  * @return \Neos\Flow\Http\Response
  */
 protected function gotoPreviousFormPage(\Symfony\Component\DomCrawler\Form $form)
 {
     $previousButton = $this->browser->getCrawler()->filterXPath('//nav[@class="form-navigation"]/*/*[contains(@class, "previous")]/button');
     $previousButton->rewind();
     $form->set(new InputFormField($previousButton->current()));
     return $this->browser->submit($form);
 }
 /**
  * @test
  */
 public function valueForDisabledCheckboxIsNotLost()
 {
     $postIdentifier = $this->setupDummyPost();
     $post = $this->persistenceManager->getObjectByIdentifier($postIdentifier, \Neos\FluidAdaptor\Tests\Functional\Form\Fixtures\Domain\Model\Post::class);
     $this->assertEquals(true, $post->getPrivate());
     $this->browser->request('http://localhost/test/fluid/formobjects/edit?fooPost=' . $postIdentifier);
     $checkboxDisabled = $this->browser->getCrawler()->filterXPath('//*[@id="private"]')->attr('disabled');
     $this->assertNotEmpty($checkboxDisabled);
     $this->assertEquals($checkboxDisabled, $this->browser->getCrawler()->filterXPath('//input[@type="hidden" and contains(@name,"private")]')->attr('disabled'), 'The hidden checkbox field is not disabled like the connected checkbox.');
     $form = $this->browser->getForm();
     $this->browser->submit($form);
     $this->persistenceManager->clearState();
     $post = $this->persistenceManager->getObjectByIdentifier($postIdentifier, \Neos\FluidAdaptor\Tests\Functional\Form\Fixtures\Domain\Model\Post::class);
     // This will currently never fail, because DomCrawler\Form does not handle hidden checkbox fields correctly!
     // Hence this test currently only relies on the correctly set "disabled" attribute on the hidden field.
     $this->assertEquals(true, $post->getPrivate(), 'The value for the checkbox field "private" was lost on form submit!');
 }