Variable SwitchConst

Switch: any = SwitchInteractor

Call this InteractorConstructor to initialize a switch Interactor. The switch interactor can be used to interact with switches on the page and to assert on their state.

The switch is located by the text of its label or by aria-label attribute.

await Switch('Theme').toggle();
await Switch('Theme').is({ disabled: true });
await Switch({ id: 'theme-toggler', disabled: true }).exists();
  • title: string – Filter by title
  • id: string – Filter by id
  • visible: boolean – Filter by visibility. Defaults to true. See isVisible.
  • valid: boolean – Filter by whether the switch is valid.
  • checked: boolean – Filter by whether the switch is checked..
  • disabled: boolean – Filter by whether the switch is disabled. Defaults to false.
  • focused: boolean – Filter by whether the switch is focused. See focused.
  • click(): Interaction – Click on the switch
  • focus(): Interaction – Focus the switch
  • blur(): Interaction – Blur the switch
  • check(): Interaction – Check the switch if it is not checked
  • uncheck(): Interaction – Uncheck the switch if it is checked
  • toggle(): Interaction – Toggle the switch