original_string: public function getElementByText($text, $selector, $textSelector = null, $baseElement = null)
      {
          if ($baseElement == null) {
              $baseElement = $this->getSession()->getPage();
          }
          $elements = $this->findAllWithWait($selector, $baseElement);
          foreach ($elements as $element) {
              if ($textSelector != null) {
                  try {
                      $elementText = $this->findWithWait($textSelector, $element)->getText();
                  } catch (\Exception $e) {
                      continue;
                  }
              } else {
                  $elementText = $element->getText();
              }
              if ($elementText == $text) {
                  return $element;
              }
          }
  
          return false;
      }
code: public function getElementByText($text, $selector, $textSelector = null, $baseElement = null)
      {
          if ($baseElement == null) {
              $baseElement = $this->getSession()->getPage();
          }
          $elements = $this->findAllWithWait($selector, $baseElement);
          foreach ($elements as $element) {
              if ($textSelector != null) {
                  try {
                      $elementText = $this->findWithWait($textSelector, $element)->getText();
                  } catch (\Exception $e) {
                      continue;
                  }
              } else {
                  $elementText = $element->getText();
              }
              if ($elementText == $text) {
                  return $element;
              }
          }
  
          return false;
      }
code_tokens: public function getElementByText ( $ text , $ selector , $ textSelector = null , $ baseElement = null ) { if ( $ baseElement == null ) { $ baseElement = $ this -> getSession ( ) -> getPage ( ) ; } $ elements = $ this -> findAllWithWait ( $ selector , $ baseElement ) ; foreach ( $ elements as $ element ) { if ( $ textSelector != null ) { try { $ elementText = $ this -> findWithWait ( $ textSelector , $ element ) -> getText ( ) ; } catch ( \ Exception $ e ) { continue ; } } else { $ elementText = $ element -> getText ( ) ; } if ( $ elementText == $ text ) { return $ element ; } } return false ; }
docstring: Finds an HTML element by class and the text value and returns it.
  
  @param string    $text           Text value of the element
  @param string    $selector       CSS selector of the element
  @param string    $textSelector   Extra CSS selector for text of the element
  @param string    $baseElement    Element in which the search is based
  @param int       $iteration      Iteration number, used to control number of executions
  @return array
docstring_tokens: Finds an HTML element by class and the text value and returns it .