clickButton method

FutureOr<void> clickButton(
  1. String selector
)

Clicks a button element.

This is a convenience method that wraps the browser's click method with page-specific context. Useful for creating readable page object methods that encapsulate button interactions.

selector is the CSS selector for the button element.

Example:

class LoginPage extends Page {
  Future<void> submitLogin() async {
    await clickButton('#login-button');
  }

  Future<void> cancelLogin() async {
    await clickButton('.cancel-btn');
  }
}

Implementation

FutureOr<void> clickButton(String selector) async {
  await browser.click(selector);
}