You are here

public function VarbaseContext::iClickOnCommandButtonInTheRichTextEditorField in Varbase: The Ultimate Drupal CMS Starter Kit (Bootstrap Ready) 8.5

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

#varbase : To click a command button in the rich text editor Example 1: When I click on "bold" command button in the rich text editor field "Body" Exmaple 2: When I click on "media" command button in the rich text editor field "Body"

@When /^I click on "([^"]*)" command button in the rich text editor field "([^"]*)"$/

File

tests/features/bootstrap/VarbaseContext.php, line 477

Class

VarbaseContext
Defines application features from the specific context.

Code

public function iClickOnCommandButtonInTheRichTextEditorField($selectorCommand, $locator) {
  $el = $this
    ->getSession()
    ->getPage()
    ->findField($locator);
  $fieldId = $el
    ->getAttribute('id');
  if (empty($fieldId)) {
    throw new Exception('Could not find an id for the rich text editor field : ' . $locator);
  }
  $this
    ->getSession()
    ->executeScript("CKEDITOR.instances[\"{$fieldId}\"].execCommand( '{$selectorCommand}' );");
}