This is a weird one. So I have the code below that I have transplanted into a service in order to run it from a controller and to be able to pass in some information.
$this->browse(function (Browser $browser) {
$browser->visit('https://urlforsite.co.uk/find-an-engineer/')
->type("EngineerId", "2231321")
->click('#checkEngineer');
if ($browser->assertSee("Engineer cannot be found")) {
dd("hello");
}
$text = $browser->text('.engineer-search-results-container .search-result .col-md-8 .row .col-xs-10 h3');
dd($text);
});
Expected outcome would be one of the DD's
dd("hello);
or dd($text);
Actual outcome:
Failed to connect to localhost port 9515: Connection refused
If I run it in an actual dusk
test and run php artisan dusk
it works correctly. Is there something that command runs first so it can get to the outside? Can this even be done?