private function EntityBrowserContext::switchJs in Lightning Media 8.3
Switches to an entity browser using JavaScript.
Parameters
string $id: The entity browser ID.
Throws
\Behat\Mink\Exception\ElementNotFoundException If the entity browser iframe does not appear after 30 seconds.
1 call to EntityBrowserContext::switchJs()
- EntityBrowserContext::selectItems in tests/
contexts/ EntityBrowserContext.behat.inc - Selects several items from an entity browser.
File
- tests/
contexts/ EntityBrowserContext.behat.inc, line 288
Class
- EntityBrowserContext
- Contains step definitions for interacting with entity browser instances.
Namespace
Acquia\LightningExtension\ContextCode
private function switchJs($id) {
$session = $this
->getSession();
$page = $session
->getPage();
$page
->pressButton('Add media');
$selector = 'iframe[name="entity_browser_iframe_' . $id . '"]';
$frame = $page
->waitFor(30, function (DocumentElement $page) use ($selector) {
return $page
->find('css', $selector);
});
if ($page) {
$session
->switchToIFrame($frame
->getAttribute('id'));
}
else {
throw new ElementNotFoundException($session
->getDriver(), 'frame', 'css', $selector);
}
}