You are here

function SelectorsContext::selectAllTextInField in Varbase: The Ultimate Drupal CMS Starter Kit (Bootstrap Ready) 8.6

Same name and namespace in other branches
  1. 8.8 tests/features/bootstrap/SelectorsContext.php \SelectorsContext::selectAllTextInField()
  2. 8.4 tests/features/bootstrap/SelectorsContext.php \SelectorsContext::selectAllTextInField()
  3. 8.5 tests/features/bootstrap/SelectorsContext.php \SelectorsContext::selectAllTextInField()
  4. 8.7 tests/features/bootstrap/SelectorsContext.php \SelectorsContext::selectAllTextInField()
  5. 9.0.x tests/features/bootstrap/SelectorsContext.php \SelectorsContext::selectAllTextInField()

#vardot : Select all text in selected field input element.

Example #1: When I select all text in "Title" field Example #2: And I select all text in "Description" field.

@When /^(?:|I )select all text in "(?P<selectedField>[^"]*)" field$/

File

tests/features/bootstrap/SelectorsContext.php, line 314

Class

SelectorsContext
Defines application features from the specific context.

Code

function selectAllTextInField($selectedField) {
  $field = $this
    ->getSession()
    ->getPage()
    ->findField($selectedField);
  $fieldid = $field
    ->getAttribute('id');
  $this
    ->getSession()
    ->getDriver()
    ->evaluateScript('document.getElementById("' . $fieldid . '").select();');
}