public static function get_behat_selector($selectortype, $element, Behat\Mink\Session $session) {

        // CSS and XPath selectors locator is one single argument.
        if ($selectortype == 'css_element' || $selectortype == 'xpath_element') {
            $selector = str_replace('_element', '', $selectortype);
            $locator = $element;
        } else {
            // Named selectors uses arrays as locators including the type of named selector.
            $allowedselectors = self::get_allowed_selectors();
            if (!isset($allowedselectors[$selectortype])) {
                throw new ExpectationException('The "' . $selectortype . '" selector not registered.', $session);
            }
            $locator = array($allowedselectors[$selectortype], behat_context_helper::escape($element));

            // Get the selector which should be used.
            $allowedpartialselectors = behat_partial_named_selector::get_allowed_selectors();
            $allowedexactselectors = behat_exact_named_selector::get_allowed_selectors();
            if (isset($allowedpartialselectors[$selectortype])) {
                $selector = 'named_partial';
            } else if (isset($allowedexactselectors[$selectortype])) {
                $selector = 'named_exact';
            } else {
                throw new ExpectationException('The "' . $selectortype . '" selector not registered.', $session);
            }
        }

        return array($selector, $locator);
    }
public static function get_behat_selector($selectortype, $element, Behat\Mink\Session $session) {

        // CSS and XPath selectors locator is one single argument.
        if ($selectortype == 'css_element' || $selectortype == 'xpath_element') {
            $selector = str_replace('_element', '', $selectortype);
            $locator = $element;
        } else {
            // Named selectors uses arrays as locators including the type of named selector.
            $allowedselectors = self::get_allowed_selectors();
            if (!isset($allowedselectors[$selectortype])) {
                throw new ExpectationException('The "' . $selectortype . '" selector not registered.', $session);
            }
            $locator = array($allowedselectors[$selectortype], behat_context_helper::escape($element));

            // Get the selector which should be used.
            $allowedpartialselectors = behat_partial_named_selector::get_allowed_selectors();
            $allowedexactselectors = behat_exact_named_selector::get_allowed_selectors();
            if (isset($allowedpartialselectors[$selectortype])) {
                $selector = 'named_partial';
            } else if (isset($allowedexactselectors[$selectortype])) {
                $selector = 'named_exact';
            } else {
                throw new ExpectationException('The "' . $selectortype . '" selector not registered.', $session);
            }
        }

        return array($selector, $locator);
    }
public static function get_behat_selector ( $ selectortype , $ element , Behat \ Mink \ Session $ session ) { // CSS and XPath selectors locator is one single argument. if ( $ selectortype == 'css_element' || $ selectortype == 'xpath_element' ) { $ selector = str_replace ( '_element' , '' , $ selectortype ) ; $ locator = $ element ; } else { // Named selectors uses arrays as locators including the type of named selector. $ allowedselectors = self :: get_allowed_selectors ( ) ; if ( ! isset ( $ allowedselectors [ $ selectortype ] ) ) { throw new ExpectationException ( 'The "' . $ selectortype . '" selector not registered.' , $ session ) ; } $ locator = array ( $ allowedselectors [ $ selectortype ] , behat_context_helper :: escape ( $ element ) ) ; // Get the selector which should be used. $ allowedpartialselectors = behat_partial_named_selector :: get_allowed_selectors ( ) ; $ allowedexactselectors = behat_exact_named_selector :: get_allowed_selectors ( ) ; if ( isset ( $ allowedpartialselectors [ $ selectortype ] ) ) { $ selector = 'named_partial' ; } else if ( isset ( $ allowedexactselectors [ $ selectortype ] ) ) { $ selector = 'named_exact' ; } else { throw new ExpectationException ( 'The "' . $ selectortype . '" selector not registered.' , $ session ) ; } } return array ( $ selector , $ locator ) ; }
Returns the behat selector and locator for a given moodle selector and locator

@param string $selectortype The moodle selector type, which includes moodle selectors
@param string $element The locator we look for in that kind of selector
@param Session $session The Mink opened session
@return array Contains the selector and the locator expected by Mink.
Returns the behat selector and locator for a given moodle selector and locator