Level 70
@laracoft How about you define one button inside a unique wrapper?
$page->within('.form-container', function ($form) {
$form->press('Register');
});
This ensures only the button inside that container is clicked.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
// pestphp/pest 4.1.0
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Laravel\Dusk\Browser;
use Pest\Browser\Api\AwaitableWebpage;
test('example', function () {
$page = visit('https://example.com')
->press('Get tickets');
$page->withinFrame('.iframe-container', function (AwaitableWebpage $page) {
$page->press('Register'); // clicks both Register buttons
});
});
The iframe has 2 buttons with "Register" as text (which I cannot rename), how do I pick only 1 and click it?
Please or to participate in this conversation.