Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot autowire service ... "$factory" of method "SensioLabs\Behat\PageObjectExtension\PageObject\Page::__construct()" references interface "Sensi oLabs\Behat\PageObjectExtension\PageObject\Factory" #144

Open
hopeseekr opened this issue Aug 18, 2022 · 1 comment

Comments

@hopeseekr
Copy link

I am seriously stumped!

Cannot autowire service "Emitter\Page\Admin\Login": argument "$factory" of method "SensioLabs\Behat\PageObjectExtension\PageObject\Page::__construct()" references interface "Sensi
oLabs\Behat\PageObjectExtension\PageObject\Factory" but no such service exists. Did you create a class that implements this interface?

The application has worked fine for years. I have upgraded it from Symfony 4 to 5 and now, with Symfony 6, I am hitting this error.

There is nothing online about it. Please help.

@jakzal
Copy link
Member

jakzal commented Aug 18, 2022

It seems that Symfony's container tries to register your page objects as a service. That would mean they're located in a directory that's autowired. Have you tried excluding the directory with page objects?

For example, if they're in src/Page:

services:
    App\:
        resource: '../src/*'
        exclude: '../src/{Page,DependencyInjection,Entity,Tests,Kernel.php}'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants