Search code examples
behatminkgoutte

How can I press on a button without a form using Goutte?


I am trying to use mink and behat to test out my application. One of the tests requires me to press on a button, but that button is tied to a javascript event. Not an actual form.

When I run the test I keep getting the following error message.

The selected node does not have a form ancestor.

Is there way I can emulate the press button without having a form?

Any help would be really appreciated. Thanks


Solution

  • Goutte (and Guzzle) will not parse / run the javascript contained within an http response. As a result you can test for the existence of the button, but not if any events associated with the button actually fire. To test for the javascript based events you will have to use a different mink-driver. I refer you to Documentation on in Browser Testing and mink documentation on available drivers.

    A