Dusk + Stripe = 无法定位元素
Dusk + Stripe = unable to locate element
我在 window 中打开付款表格,每次 Dusk 都在努力寻找屏幕上的输入元素。我尝试添加 pause(3)
但没有任何效果。
我是运行laravel 5.5和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');
我试过:
- 在
type('cardnumber')
之前使用 ->pause(3000)
但什么也没做
- 使用
->keys('input[name=cardnumber]', '4242424242424242')
但什么也没做
我报错
Facebook\WebDriver\Exception\NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"body textar ea[name='cardnumber']"}
当使用 keys()
我得到:Facebook\WebDriver\Exception\NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"body input[name=cardnumber]"}
我建议所有处于类似位置的人将 Laravel 升级到 5.7,将 Dusk 升级到 5.0。
Dusk 有一个名为 withinFrame()
的新方法,它使测试更易于编写和阅读:
https://github.com/laravel/dusk/commit/8bfb9f01ae09d1d9ca3ce53e36b1f020c0f8dc8f
我在 window 中打开付款表格,每次 Dusk 都在努力寻找屏幕上的输入元素。我尝试添加 pause(3)
但没有任何效果。
我是运行laravel 5.5和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');
我试过:
- 在
type('cardnumber')
之前使用->pause(3000)
但什么也没做 - 使用
->keys('input[name=cardnumber]', '4242424242424242')
但什么也没做
我报错
Facebook\WebDriver\Exception\NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"body textar ea[name='cardnumber']"}
当使用 keys()
我得到:Facebook\WebDriver\Exception\NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"body input[name=cardnumber]"}
我建议所有处于类似位置的人将 Laravel 升级到 5.7,将 Dusk 升级到 5.0。
Dusk 有一个名为 withinFrame()
的新方法,它使测试更易于编写和阅读:
https://github.com/laravel/dusk/commit/8bfb9f01ae09d1d9ca3ce53e36b1f020c0f8dc8f