Package org.openqa.selenium

Examples of org.openqa.selenium.InvalidSelectorException


  }

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


        String tmp = method.substring(0, 1).toUpperCase() + method.toLowerCase().substring(1) + "Criteria";
        String clazz = AbstractCriteria.class.getPackage().getName() + "." + tmp;
        Class<? extends PropertyEqualCriteria> c = (Class<? extends PropertyEqualCriteria>) Class.forName(clazz);
        return (T) buildPropertyBaseCriteria(serialized, c, decorator);
      default:
        throw new InvalidSelectorException("can't find the type : " + serialized.toString());
      }
    } catch (Exception e) {
      throw new WebDriverException(e);
    }
View Full Code Here

  private static ComposedCriteria buildComposedCriteria(JSONObject serialized, CompositionType type,
      CriteriaDecorator decorator) throws Exception {
    JSONArray array = serialized.getJSONArray(type.toString());
    if (type == CompositionType.NOT && array.length() != 1) {
      throw new InvalidSelectorException("negative criteria apply to 1 criteria only " + serialized);
    }
    List<Criteria> criterias = new ArrayList<Criteria>();

    for (int i = 0; i < array.length(); i++) {
      JSONObject c = array.getJSONObject(i);
View Full Code Here

      return value;
    }
    if ("class name".equals(type)) {
      // detect composite class name
      if (isCompoundName(value)) {
        throw new InvalidSelectorException("Compound class names aren't allowed");
      }
      return "." + value;
    }
    if ("class name".equals(type)) {
      return "." + value;
View Full Code Here

  public Map<String, String> findElementByXpath(String xpath) {
    try {
      return findElementByXpath(xpath, document);
    } catch (XPathExpressionException e) {
      throw new InvalidSelectorException("wrong xpath " + xpath, e);
    }
  }
View Full Code Here

  public Map<String, String> findElementByXpath(String xpath, String reference) {
    try {
      return findElementByXpath(xpath, getNode(reference));
    } catch (XPathExpressionException e) {
      throw new InvalidSelectorException("wrong xpath " + xpath, e);
    }

  }
View Full Code Here

  public List<Map<String, String>> findElementsByXpath(String xpath, String reference) {
    try {
      return findElementsByXpath(xpath, getNode(reference));
    } catch (XPathExpressionException e) {
      throw new InvalidSelectorException("wrong xpath " + xpath, e);
    }
  }
View Full Code Here

      JSONObject json = payload.getJSONObject("criteria");
      return json;
    } else if (payload.has("using")) {
      return getCriteriaFromWebDriverSelector(payload);
    } else {
      throw new InvalidSelectorException("wrong format for the findElement command " + payload);
    }
  }
View Full Code Here

      try {
        Package p = UIAElement.class.getPackage();
        Criteria c = new TypeCriteria(Class.forName(p.getName() + "." + value));
        return c.stringify();
      } catch (ClassNotFoundException e) {
        throw new InvalidSelectorException(value + " is not a recognized type.");
      }
      //  http://developer.apple.com/library/ios/#documentation/uikit/reference/UIAccessibilityIdentification_Protocol/Introduction/Introduction.html
    } else if ("name".equals(using) || "id".equals(using)) {
      Criteria c = new NameCriteria(getAUT().applyL10N(value));
      return c.stringify();
    } else if ("link text".equals(using) || "partial link text".equals(using)) {
      return createGenericCriteria(using, value);
    } else {
      throw new InvalidSelectorException(
          using + "is not a valid selector for the native part of ios-driver.");
    }
  }
View Full Code Here

    } else if ("value".equals(prop)) {
      return new ValueCriteria(val, strategy).stringify();
    } else if ("label".equals(prop)) {
      return new LabelCriteria(val, strategy).stringify();
    } else {
      throw new InvalidSelectorException(
          prop
          + "is not a valid selector for the native part of ios-driver.name | value | label");
    }
  }
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.