【问题标题】:Selenium with Laravel :: There are no commands defined in the "selenium" namespaceSelenium with Laravel :: 在“selenium”命名空间中没有定义命令
【发布时间】:2017-09-12 21:35:56
【问题描述】:

我通过 composer 运行以下命令在 Laravel 上安装了 selenium

composer require modelizer/selenium "~1.0"

并添加下面列出的代码块以在 app.php 中注册服务提供者Modelizer\Selenium\SeleniumServiceProvider::class

$app->singleton(
    Modelizer\Selenium\SeleniumServiceProvider::class
);

将配置设置为.env 文件。

APP_URL="http://example.dev/"
SELENIUM_WIDTH=1024
SELENIUM_HEIGHT=768

清除 laravel 配置缓存文件。

$php artisan config:clear

但是当我尝试使用命令 php artisan selenium:start 启动 selenium 服务器时,出现以下错误。

[Symfony\Component\Console\Exception\CommandNotFoundException]

There are no commands defined in the "selenium" namespace.

请帮我摆脱这个问题。

【问题讨论】:

  • 如果你输入 php artisan ,你会看到与 selenium 没有任何关系。基本上你还没有 selenium 命令。我认为您的安装失败了。
  • 它安装成功,没有任何错误消息,但也没有add命令,它应该在安装时出现。

标签: php selenium laravel-5 phpunit tdd


【解决方案1】:

我觉得没有必要补充

$app->singleton(
    Modelizer\Selenium\SeleniumServiceProvider::class
);

因为你已经在 app.php 文件中注册了Modelizer\Selenium\SeleniumServiceProvider::class

关于php artisan add modelizer/selenium 将在您添加https://github.com/Qafeen/Manager 包时起作用

【讨论】:

    【解决方案2】:

    尝试运行以下命令:

    php artisan add modelizer/selenium
    php artisan selenium:start
    

    【讨论】:

    • 在运行php artisan add modelizer/selenium 时出现Command "add" is not defined. 错误
    猜你喜欢
    • 2016-11-03
    • 2014-11-28
    • 2022-10-17
    • 2019-10-29
    • 1970-01-01
    • 1970-01-01
    • 2018-06-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多