public function getText($xpath) {
    $elements = $this->findElement($xpath, 1);
    //allText works only with ONE element so it will be the first one and also returns new lines that we will remove
    $text = $this->browser->allText($elements["page_id"], $elements["ids"][0]);
    $text = trim(str_replace(array("\r", "\r\n", "\n"), ' ', $text));
    $text = preg_replace('/ {2,}/', ' ', $text);
    return $text;
  }
public function getText($xpath) {
    $elements = $this->findElement($xpath, 1);
    //allText works only with ONE element so it will be the first one and also returns new lines that we will remove
    $text = $this->browser->allText($elements["page_id"], $elements["ids"][0]);
    $text = trim(str_replace(array("\r", "\r\n", "\n"), ' ', $text));
    $text = preg_replace('/ {2,}/', ' ', $text);
    return $text;
  }
public function getText ( $ xpath ) { $ elements = $ this -> findElement ( $ xpath , 1 ) ; //allText works only with ONE element so it will be the first one and also returns new lines that we will remove $ text = $ this -> browser -> allText ( $ elements [ "page_id" ] , $ elements [ "ids" ] [ 0 ] ) ; $ text = trim ( str_replace ( array ( "\r" , "\r\n" , "\n" ) , ' ' , $ text ) ) ; $ text = preg_replace ( '/ {2,}/' , ' ' , $ text ) ; return $ text ; }
Given xpath, will try to get ALL the text, visible and not visible from such xpath
@param string $xpath
@return string
@throws DriverException
Given xpath will try to get ALL the text visible and not visible from such xpath