dusk: Using `type` or `keys` sometimes does not finish

I’ve been trying to work around this issue but nothing seems to consistently work. I’ve tried both type('selector', 'text') as well as keys('selector', 'text') but sometimes it just doesn’t finish typing everything. There is no consistency here, sometimes it works, sometimes it doesn’t. I even tried to do a pause(1000) after type’ing or keys’ing. I feel like this is a fundamental issue unless someone here has any idea what’s going on.

Test Code (this one is specifically a Bootstrap modal, but regular forms have issues too)

public function copyExisting(Browser $oBrowser, $sCopyName, $sJobNumber = '8675309') {
  $oBrowser->waitFor('input[name=newName]')
    ->type('input[name=newName]', $sCopyName)
    ->type('input[name=newJobNumber]', $sJobNumber)
    ->press('DONE');
}

Have you tried to reproduce on a clean install?

  • Tested on clean install

Have you tried to isolate the elements that causes the issue?

  • There is no isolation needed here. I’ve isolated on every possible thing and can reproduce it sporadically.

Have you tested with different elements?

  • Tested with different elements, both newName and newJobNumber above.

Have you tested with different pages?

  • Have tested it with different pages.

What OS are you running it on?

  • Running this on a vagrant box (boxcutter/ubuntu1604) within macOS (10.12.4 - Sierra).

Are you using GUI (Graphic User Interface)? Can you actually see the browser?

  • Yes, using GUI. Can see the browser and see it failing to finish typing.

How do you detect the problem? Do you see half the text in the screenshot?

  • Both screenshot and GUI.

What error messages do you have?

  • Error message comes when I try and look for the element because it can’t find it due to text not matching.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 2
  • Comments: 19 (8 by maintainers)

Most upvoted comments

Same bug here:

$this->browse(function (Browser $browser) {
    $headline = $this->generateHeadline('head1');

    $browser->visit(new PlainPage())
        ->toSomePlainPageActions()
        ->whenAvailable('@block_modal', function ($modal) use($headline) {
            $modal->select('tag', 'h3')
                ->type('title',$headline) //<---- HERE IS THE PROBLEM
                ->press('Save changes');
        }) ->waitUntilMissing('@block_modal')
        ->assertSee($headline);
});

$headline is e.g string(46) Voluptas ad ab assumenda cupiditate. and type only insert string(2) Vo

my fix or (%#$#) workaround is to go across value so

$modal->select('tag', 'h3')
    ->value('input[name=title]',$headline) //<---- FIXES THE PROBLEM
    ->press('Save changes');

I dont have debugged this deeper but the problem is is in the driver sendKeys function. keys and type use this function, so switch between them will not help.

@driesvints This is not solved, I’m currently fighting with exactly the same issue. Automatically closing every old issue is a very poor way to maintain a project.

For me it just hangs when typing into a password field.

I’m having the same problem

laravel/dusk 2.0 laravel 5.5

The solution proposed by @ryancwalsh doesn’t work for me

My workaround was to take a screenshot before button click

… ->type(‘field’,’some text’) ->screenShot(“aShot”) ->press(“button[id=‘resourceSaveButton’]”) …