public function translateToXPath($locator)
    {
        if (!is_string($locator)) {
            throw new \InvalidArgumentException('The CssSelector expects to get a string as locator');
        }

        // Symfony 2.8+ API
        if (class_exists('Symfony\Component\CssSelector\CssSelectorConverter')) {
            $converter = new CssSelectorConverter();

            return $converter->toXPath($locator);
        }

        // old static API for Symfony 2.7 and older
        return CSS::toXPath($locator);
    }