function SelectorsContext::selectAllTextInField in Varbase: The Ultimate Drupal CMS Starter Kit (Bootstrap Ready) 8.4
Same name and namespace in other branches
- 8.8 tests/features/bootstrap/SelectorsContext.php \SelectorsContext::selectAllTextInField()
- 8.5 tests/features/bootstrap/SelectorsContext.php \SelectorsContext::selectAllTextInField()
- 8.6 tests/features/bootstrap/SelectorsContext.php \SelectorsContext::selectAllTextInField()
- 8.7 tests/features/bootstrap/SelectorsContext.php \SelectorsContext::selectAllTextInField()
- 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();');
}