protected function ensureTreeNodeIsOpen(string $nodeText, RemoteWebElement $context)
    {
        $I = $this->tester;
        $I->see($nodeText, self::$treeItemSelector);

        /** @var RemoteWebElement $context */
        $context = $I->executeInSelenium(function () use ($nodeText, $context
        ) {
            return $context->findElement(\WebDriverBy::xpath('//*[text()=\'' . $nodeText . '\']/..'));
        });

        try {
            $context->findElement(\WebDriverBy::cssSelector('.chevron.collapsed'))->click();
        } catch (\Facebook\WebDriver\Exception\NoSuchElementException $e) {
            // element not found so it may be already opened...
        } catch (\Facebook\WebDriver\Exception\ElementNotVisibleException $e) {
            // element not found so it may be already opened...
        }

        return $context;
    }
protected function ensureTreeNodeIsOpen(string $nodeText, RemoteWebElement $context)
    {
        $I = $this->tester;
        $I->see($nodeText, self::$treeItemSelector);

        /** @var RemoteWebElement $context */
        $context = $I->executeInSelenium(function () use ($nodeText, $context
        ) {
            return $context->findElement(\WebDriverBy::xpath('//*[text()=\'' . $nodeText . '\']/..'));
        });

        try {
            $context->findElement(\WebDriverBy::cssSelector('.chevron.collapsed'))->click();
        } catch (\Facebook\WebDriver\Exception\NoSuchElementException $e) {
            // element not found so it may be already opened...
        } catch (\Facebook\WebDriver\Exception\ElementNotVisibleException $e) {
            // element not found so it may be already opened...
        }

        return $context;
    }
protected function ensureTreeNodeIsOpen ( string $ nodeText , RemoteWebElement $ context ) { $ I = $ this -> tester ; $ I -> see ( $ nodeText , self :: $ treeItemSelector ) ; /** @var RemoteWebElement $context */ $ context = $ I -> executeInSelenium ( function ( ) use ( $ nodeText , $ context ) { return $ context -> findElement ( \ WebDriverBy :: xpath ( '//*[text()=\'' . $ nodeText . '\']/..' ) ) ; } ) ; try { $ context -> findElement ( \ WebDriverBy :: cssSelector ( '.chevron.collapsed' ) ) -> click ( ) ; } catch ( \ Facebook \ WebDriver \ Exception \ NoSuchElementException $ e ) { // element not found so it may be already opened... } catch ( \ Facebook \ WebDriver \ Exception \ ElementNotVisibleException $ e ) { // element not found so it may be already opened... } return $ context ; }
Search for an element with the given link text in the provided context.

@param string $nodeText
@param RemoteWebElement $context
@return RemoteWebElement
Search for an element with the given link text in the provided context .