FriendsOfBehat / SymfonyExtension

:musical_score: Extension integrating Behat with Symfony.
MIT License
472 stars 62 forks source link

Button clicking #202

Closed magikid closed 8 months ago

magikid commented 11 months ago

I'm trying to write a test to click a button and getting this message:

    And I press "Add an asset"                                                # Behat\MinkExtension\Context\MinkContext::pressButton()                                                                                                                              
      Behat\Mink\Exception\UnsupportedDriverActionException: FriendsOfBehat\SymfonyExtension\Driver\SymfonyDriver supports clicking on links and submit or reset buttons only. But "button" provided in vendor/friends-of-behat/mink-browserkit-driver/src/BrowserKitDriver.php:500 

Why doesn't the extension support clicking on arbitrary buttons? Would you accept a PR to change the functionality?

stof commented 8 months ago

This is not related to this extension but to the underlying Mink driver being used.

When using the Selenium-based driver, clicking on anything is supported (whether it has an effect depends on what the page does). When using the BrowserKitDriver, the interaction is emulated without any support for Javascript. In such case, clicking on a <button type="button"> is not supported because it can only have a effect for JS listeners, that are not supported.

magikid commented 8 months ago

Alright, closing it here then. Thanks!