The BehatMagento2Extension
provides a custom service container for Behat which allows to inject Magento services into Behat Contexts and Behat helper services.
The recommended installation method is through Composer:
composer require --dev bex/behat-magento2-extension
The official documentation is available here.