laravel-console-dusk
laravel-console-dusk copied to clipboard
How run dusk in job?
Hello! I need run dusk in laravel job. `namespace App\Jobs;
use Illuminate\Bus\Queueable; use Illuminate\Queue\SerializesModels; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable;
use NunoMaduro\LaravelConsoleDusk\Manager; use Facebook\WebDriver\WebDriverBy;
class bot implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
private $order;
protected $browser_manager = null;
protected $browser = null;
protected $faker = null;
protected $screenshot = true;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct(Order $order)
{
$this->order = $order;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$browser = new Manager(new \App\Helpers\Contracts\Chrome());
$browser->browse($this, function ($browser) {
$test = $browser
->visit('https://test.loc');
}) ;
}
}`
i get error:
local.ERROR: Argument 1 passed to NunoMaduro\LaravelConsoleDusk\Manager::browse() must be an instance of Illuminate\Console\Command, instance of App\Jobs\bot given, called in /home/vagrant/code/p1/app/Jobs/bot.php on line 258 {"exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Argument 1 passed to NunoMaduro\LaravelConsoleDusk\Manager::browse() must be an instance of Illuminate\Console\Command, instance of App\Jobs\bot given, called in /home/vagrant/code/p1/app/Jobs/bot.php on line 258 at /home/vagrant/code/p1/vendor/nunomaduro/laravel-console-dusk/src/Manager.php:26)
i test another code to:
resolve(Manager::class)->browse($this,....
the result is the same. How use your code in job?