Package org.openqa.selenium

Examples of org.openqa.selenium.InvalidSelectorException


        break;
      case ends:
        newValue = "(.*)" + oldValue;
        break;
      default:
        throw new InvalidSelectorException("Can't find strategy");
    }
    criteria.setValue(newValue);
    criteria.setMatchingStrategy(MatchingStrategy.regex);

  }
View Full Code Here


    if (isAvailable) {
      String error =
          debugger.callFunctionOnObject("return (locator instanceof Error) ? locator.message : ''",
                                        id);
      if (!error.isEmpty()) {
        throw new InvalidSelectorException(error);
      }

      Boolean isStale =
          Boolean.valueOf(debugger.callFunctionOnObject("locator.parentNode == undefined", id));
View Full Code Here

      }

      String error = debugger.callFunctionOnObject(
          "return (locator instanceof Error) ? locator.message : ''", id);
      if (!error.isEmpty()) {
        throw new InvalidSelectorException(error);
      }

      elements = processElements(id);

      if (elements != null) {
View Full Code Here

        if (className == null)
            throw new IllegalArgumentException(
                    "Cannot find elements when the class name expression is null.");

        if (className.matches(".*\\s+.*")) {
            throw new InvalidSelectorException(
                    "Compound class names are not supported. Consider searching for one class name and filtering the results.");
        }

        return new ByStrictClassName(className);
    }
View Full Code Here

  @Test
  public void detectsIfWebdriverReportedInvalidSelectorError() {
    assertFalse(Cleanup.of.isInvalidSelectorError(null));
    assertFalse(Cleanup.of.isInvalidSelectorError(new WebDriverException("Ups!")));
    assertTrue(Cleanup.of.isInvalidSelectorError(new InvalidSelectorException("Wrong xpath")));
    assertTrue(Cleanup.of.isInvalidSelectorError(new WebDriverException("An invalid or illegal string was specified\n")));
    assertTrue(Cleanup.of.isInvalidSelectorError(new WebDriverException("invalid element state: Failed to execute query: '//input[:attr='al]' is not a valid selector.\n")));
    assertTrue(Cleanup.of.isInvalidSelectorError(new WebDriverException("Invalid selectors: //input[:attr='al]")));
    assertTrue(Cleanup.of.isInvalidSelectorError(new WebDriverException("{\"errorMessage\":\"SYNTAX_ERR: DOM Exception 12\",,\"post\":\"{\\\"using\\\":\\\"css selector\\\",\\\"value\\\":\\\"//input[:attr='al]\\\"}\"}}\n")));
    assertTrue(Cleanup.of.isInvalidSelectorError(new WebDriverException("{\"errorMessage\":\"Unable to locate an element with the xpath expression //xxx[@' because of the following error:\\nError: INVALID_EXPRESSION_ERR: DOM XPath Exception 51\"}}\n")));
View Full Code Here

  }

  public InvalidSelectorException wrap(Exception error) {
    return (error instanceof InvalidSelectorException) ?
        (InvalidSelectorException) error :
        new InvalidSelectorException("Invalid selector", error);
  }
View Full Code Here

  }

  public InvalidSelectorException wrap(RuntimeException error) {
    return (error instanceof InvalidSelectorException) ?
        (InvalidSelectorException) error :
        new InvalidSelectorException("Invalid selector", error);
  }
View Full Code Here

TOP

Related Classes of org.openqa.selenium.InvalidSelectorException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.