public AstCssFunctionalPseudoClassCondition(T argument) { if (argument == null) { throw new AstCssFunctionalPseudoClassHasNoArgumentsException(); } this.argument = argument; }
public AstCssFunctionalPseudoClassCondition(T argument) { if (argument == null) { throw new AstCssFunctionalPseudoClassHasNoArgumentsException(); } this.argument = argument; }
@VisibleForTesting static int extractIndexArgument(String indexPseudoClassArgument, String pseudoClassName) { if (indexPseudoClassArgument == null) { throw new AstCssFunctionalPseudoClassHasNoArgumentsException(); } Matcher m = INDEX_REGEX.matcher(indexPseudoClassArgument); boolean isArgumentAnInteger = m.find(); if (!isArgumentAnInteger) { String reason = String.format("The :%s() pseudo-class requires an integer as argument but got: \"%s\".", pseudoClassName, indexPseudoClassArgument); throw new InvalidPseudoClassSelectorException(reason); } String integerIndex = m.group(1); if (integerIndex.startsWith("+")) { integerIndex = integerIndex.substring(1); } return Integer.valueOf(integerIndex); }
@VisibleForTesting static int extractIndexArgument(String indexPseudoClassArgument, String pseudoClassName) { if (indexPseudoClassArgument == null) { throw new AstCssFunctionalPseudoClassHasNoArgumentsException(); } Matcher m = INDEX_REGEX.matcher(indexPseudoClassArgument); boolean isArgumentAnInteger = m.find(); if (!isArgumentAnInteger) { String reason = String.format("The :%s() pseudo-class requires an integer as argument but got: \"%s\".", pseudoClassName, indexPseudoClassArgument); throw new InvalidPseudoClassSelectorException(reason); } String integerIndex = m.group(1); if (integerIndex.startsWith("+")) { integerIndex = integerIndex.substring(1); } return Integer.valueOf(integerIndex); }
private CssSelectorList parseFunctionalPseudoClassSelectorArgument(String pseudoClassName, String selector) { if (selector == null) { throw new AstCssFunctionalPseudoClassHasNoArgumentsException(); } try { return ParseTreeBuilder.parse(selector); } catch (SeleniumQueryException e) { throw new SeleniumQueryException("Error while parsing pseudo-class `:" + pseudoClassName + "(" +selector+")`: " + e.getLocalizedMessage(), e); } }
private CssSelectorList parseFunctionalPseudoClassSelectorArgument(String pseudoClassName, String selector) { if (selector == null) { throw new AstCssFunctionalPseudoClassHasNoArgumentsException(); } try { return ParseTreeBuilder.parse(selector); } catch (SeleniumQueryException e) { throw new SeleniumQueryException("Error while parsing pseudo-class `:" + pseudoClassName + "(" +selector+")`: " + e.getLocalizedMessage(), e); } }