Chris@0: getSession()->getPage(); Chris@16: $page->waitFor(10, function () use ($page, $selector) { Chris@16: return $page->find('css', "$selector .contextual-links"); Chris@16: }); Chris@16: Chris@0: if ($force_visible) { Chris@0: $this->toggleContextualTriggerVisibility($selector); Chris@0: } Chris@0: Chris@0: $element = $this->getSession()->getPage()->find('css', $selector); Chris@0: $element->find('css', '.contextual button')->press(); Chris@0: $element->findLink($link_locator)->click(); Chris@0: Chris@0: if ($force_visible) { Chris@0: $this->toggleContextualTriggerVisibility($selector); Chris@0: } Chris@0: } Chris@0: Chris@0: /** Chris@0: * Toggles the visibility of a contextual trigger. Chris@0: * Chris@0: * @param string $selector Chris@0: * The selector for the element that contains the contextual link. Chris@0: */ Chris@0: protected function toggleContextualTriggerVisibility($selector) { Chris@0: // Hovering over the element itself with should be enough, but does not Chris@0: // work. Manually remove the visually-hidden class. Chris@0: $this->getSession()->executeScript("jQuery('{$selector} .contextual .trigger').toggleClass('visually-hidden');"); Chris@0: } Chris@0: Chris@0: }