public function clickButton(string $label, int $indexOfButton = 0): void
    {
        $formButtons = $this->context->findAllElements($this->fields['button'], $this->context->findElement($this->fields['mainFormSection']));
        $filteredButtons = array_values(array_filter($formButtons, function ($element) use ($label) { return $element->getText() === $label; }));

        $filteredButtons[$indexOfButton]->click();
    }
public function clickButton(string $label, int $indexOfButton = 0): void
    {
        $formButtons = $this->context->findAllElements($this->fields['button'], $this->context->findElement($this->fields['mainFormSection']));
        $filteredButtons = array_values(array_filter($formButtons, function ($element) use ($label) { return $element->getText() === $label; }));

        $filteredButtons[$indexOfButton]->click();
    }
public function clickButton ( string $ label , int $ indexOfButton = 0 ) : void { $ formButtons = $ this -> context -> findAllElements ( $ this -> fields [ 'button' ] , $ this -> context -> findElement ( $ this -> fields [ 'mainFormSection' ] ) ) ; $ filteredButtons = array_values ( array_filter ( $ formButtons , function ( $ element ) use ( $ label ) { return $ element -> getText ( ) === $ label ; } ) ) ; $ filteredButtons [ $ indexOfButton ] -> click ( ) ; }
Click button with given label.

@param string $label
@param int $indexOfButton
Click button with given label .