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);
    }