src/Services/InteractWithPage.php
protected function click($textOrId)
    {
        $element = $this->wd->findElement(WebDriverBy::xpath("//a[contains(., '{$textOrId}')]"));

        try {
            $element->click();
        } catch (\Exception $e) {
            throw new CannotClickElement('Cannot click the element with the text: '.$textOrId);
        }

        return $this;
    }
protected function click($textOrId)
    {
        $element = $this->wd->findElement(WebDriverBy::xpath("//a[contains(., '{$textOrId}')]"));

        try {
            $element->click();
        } catch (\Exception $e) {
            throw new CannotClickElement('Cannot click the element with the text: '.$textOrId);
        }

        return $this;
    }
protected function click ( $ textOrId ) { $ element = $ this -> wd -> findElement ( WebDriverBy :: xpath ( "//a[contains(., '{$textOrId}')]" ) ) ; try { $ element -> click ( ) ; } catch ( \ Exception $ e ) { throw new CannotClickElement ( 'Cannot click the element with the text: ' . $ textOrId ) ; } return $ this ; }
Click an element based on text passed in, or pass an Id or Name to find the element by.

@param $textOrId

@throws CannotClickElement Throws when the element cannot be clicked

@return $this
Click an element based on text passed in or pass an Id or Name to find the element by .