public function clickToolbarLink(string $link)
    {
        $link_parts = array_map('trim', preg_split('/(?<!\\\\)>/', $link));
        $click_node = false;

        $first_level_items = $this->findAll('css', '.ab-top-menu > li');

        foreach ($first_level_items as $first_level_item) {
            if (! $this->elementIsTargetLink($first_level_item, $link_parts[0])) {
                continue;
            }

            if (count($link_parts) > 1) {
                $click_node = $this->getSubmenuLinkNode($first_level_item, $link_parts[1]);
            } else {
                // We are clicking a top-level item:
                $click_node = $first_level_item->find('css', 'a');
            }

            break;
        }

        if (false === $click_node) {
            throw new ExpectationException(
                sprintf('[W403] Toolbar link "%s" could not be found', $link),
                $this->getDriver()
            );
        }

        $click_node->click();
    }
public function clickToolbarLink(string $link)
    {
        $link_parts = array_map('trim', preg_split('/(?<!\\\\)>/', $link));
        $click_node = false;

        $first_level_items = $this->findAll('css', '.ab-top-menu > li');

        foreach ($first_level_items as $first_level_item) {
            if (! $this->elementIsTargetLink($first_level_item, $link_parts[0])) {
                continue;
            }

            if (count($link_parts) > 1) {
                $click_node = $this->getSubmenuLinkNode($first_level_item, $link_parts[1]);
            } else {
                // We are clicking a top-level item:
                $click_node = $first_level_item->find('css', 'a');
            }

            break;
        }

        if (false === $click_node) {
            throw new ExpectationException(
                sprintf('[W403] Toolbar link "%s" could not be found', $link),
                $this->getDriver()
            );
        }

        $click_node->click();
    }
public function clickToolbarLink ( string $ link ) { $ link_parts = array_map ( 'trim' , preg_split ( '/(?<!\\\\)>/' , $ link ) ) ; $ click_node = false ; $ first_level_items = $ this -> findAll ( 'css' , '.ab-top-menu > li' ) ; foreach ( $ first_level_items as $ first_level_item ) { if ( ! $ this -> elementIsTargetLink ( $ first_level_item , $ link_parts [ 0 ] ) ) { continue ; } if ( count ( $ link_parts ) > 1 ) { $ click_node = $ this -> getSubmenuLinkNode ( $ first_level_item , $ link_parts [ 1 ] ) ; } else { // We are clicking a top-level item: $ click_node = $ first_level_item -> find ( 'css' , 'a' ) ; } break ; } if ( false === $ click_node ) { throw new ExpectationException ( sprintf ( '[W403] Toolbar link "%s" could not be found' , $ link ) , $ this -> getDriver ( ) ) ; } $ click_node -> click ( ) ; }
Click a specific item in the toolbar.

Top-level items are identified by their link text (e.g. 'Comments').
Second-level items are identified by their parent text and link text,
delimited by a right angle bracket. E.g. New > Post.

@param string $link The toolbar item to click.

@throws \Behat\Mink\Exception\ExpectationException If the menu item does not exist
Click a specific item in the toolbar .