1
votes

I open a payment form in a window and each time Dusk is struggling to find the input elements on the screen. I have tried adding pause(3) but that did nothing.

I am running laravel 5.5 and Dusk 2.0.

        $browser->waitFor('.stripe-card iframe', 30);

        // Lets make the switch to iframe
        $browser->driver
            ->switchTo()
            ->frame('__privateStripeFrame5');

        $browser->type('cardnumber', '4242424242424242')
            ->type('exp-date', '12 50')
            ->type('cvc', '123');

I have tried:

  1. using ->pause(3000) before type('cardnumber') but did nothing
  2. using ->keys('input[name=cardnumber]', '4242424242424242') but did nothing

The error that I am given Facebook\WebDriver\Exception\NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"body textar ea[name='cardnumber']"}

When using keys() i get: Facebook\WebDriver\Exception\NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"body input[name=cardnumber]"}

1
What's the error message?Jonas Staudenmeir
Facebook\WebDriver\Exception\NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"body textar ea[name='cardnumber']"}Vlad Vladimir Hercules
What does the screenshot in tests/Browser/screenshots show?Jonas Staudenmeir
I dont see the iframe in the screenshotVlad Vladimir Hercules
I added ->pause(3000) - the iframe appeared and still the same issueVlad Vladimir Hercules

1 Answers

0
votes

I would recommend to everyone in a similar position to upgrade Laravel to 5.7 and Dusk to 5.0.

Dusk has a new method called withinFrame() which makes testing easier to write and clearer to read:

https://github.com/laravel/dusk/commit/8bfb9f01ae09d1d9ca3ce53e36b1f020c0f8dc8f