I'm trying to run some basic Laravel Dusk Tests but always running into problems with the Facebook WebDriver:
I already updated chrome to the latest version and manually updated the Chrome WebDriver with Hombrew:
Any suggestions?
Cheers, Stan
Error:
Tests\Browser\Tests\Auth\SignUpTest::a_user_can_sign_up
Facebook\WebDriver\Exception\NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"body textarea[name='input[name="name"]']"}
(Session info: headless chrome=64.0.3282.119)
(Driver info: chromedriver=2.33.506106 (8a06c39c4582fbfbab6966dbb1c38a9173bfb1a2),platform=Mac OS X 10.12.6 x86_64)
MySignUpTest:
public function a_user_can_sign_up()
{
$this->browse(function (Browser $browser) {
$browser->visit(new SignUpPage)
->signUp('Erika Musterfrau', '[email protected]', 'password', 'password')
->assertPathIs('/dashboard')
->assertSeeIn('.navbar', 'Erika Musterfrau');
});
}
MySignUpPage:
public function assert(Browser $browser)
{
$browser->assertPathIs('/register');
}
public function signUp(Browser $browser, $name = null, $email = null, $password = null, $passwordConfirmation = null)
{
$browser->type('@name', $name)
->type('@email', $email)
->type('@password', $password)
->type('@password_confirmation', $passwordConfirmation)
->press('Register');
}
/**
* Get the element shortcuts for the page.
*
* @return array
*/
public function elements()
{
return [
'@name' => 'input[name="name"]',
'@email' => 'input[name="email"]',
'@password' => 'input[name="password"]',
'@password_confirmation' => 'input[name="password_confirmation"]',
];
}
OneOfMyRegisterInputViews:
<div class="form-group row">
<div class="col-lg-8 offset-2">
<input placeholder="name"
type="text"
class="form-control{{ $errors->has('name') ? ' is-invalid' : '' }}"
name="name"
value="{{ old('name') }}"
required
>
@if ($errors->has('name'))
<div class="invalid-feedback">
<strong>{{ $errors->first('name') }}</strong>
</div>
@endif
</div>
</div>
For those who still have a problem: check APP_URL variable in your Laravel's .env file. URL on which the application is running must match with the APP_URL parameter
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With