You are here

public function VarbaseContext::iClickButtonUnderTheEditorMediaBrowser 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::iClickButtonUnderTheEditorMediaBrowser()
  2. 8.4 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iClickButtonUnderTheEditorMediaBrowser()
  3. 8.6 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iClickButtonUnderTheEditorMediaBrowser()
  4. 8.7 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iClickButtonUnderTheEditorMediaBrowser()
  5. 9.0.x tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iClickButtonUnderTheEditorMediaBrowser()

#varbase : To click on a link or button under the editor media browser

Example 1: When I click "Submit" button under the media browser Example 2: When I click "Submit" under media browser Example 3: When I click "Upload" under the media browser

@When /^I click "([^"]*)" (?:|button )under (?:|the )editor media browser$/

File

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

Class

VarbaseContext
Defines application features from the specific context.

Code

public function iClickButtonUnderTheEditorMediaBrowser($text) {

  // Switch to the "mediaBrowser" iframe.
  $this
    ->getSession()
    ->switchToIFrame('entity_browser_iframe_editor_media_browser');

  // Find the Tab by txt
  $element = $this
    ->getSession()
    ->getPage()
    ->find('xpath', "//*[contains(@class, 'button') and text() = '{$text}']");
  if (empty($element)) {
    throw new Exception('The editor media browser dose not have [ ' . $text . ' ] button.');
  }
  $element
    ->click();

  // Switch back too the page from the "entity_browser_iframe_editor_media_browser" iframe.
  $this
    ->getSession()
    ->switchToIFrame(null);
}