public enum

Locator

extends java.lang.Enum<Locator>

 java.lang.Object

↳java.lang.Enum<Locator>

↳androidx.test.espresso.web.webdriver.Locator

Gradle dependencies

compile group: 'androidx.test.espresso', name: 'espresso-web', version: '3.5.0-alpha06'

  • groupId: androidx.test.espresso
  • artifactId: espresso-web
  • version: 3.5.0-alpha06

Artifact androidx.test.espresso:espresso-web:3.5.0-alpha06 it located at Google repository (https://maven.google.com/)

Androidx artifact mapping:

androidx.test.espresso:espresso-web com.android.support.test.espresso:espresso-web

Androidx class mapping:

androidx.test.espresso.web.webdriver.Locator android.support.test.espresso.web.webdriver.Locator

Overview

Valid WebDriver locatorType types.

Summary

Enum Constants
CLASS_NAME
CSS_SELECTOR
ID
LINK_TEXT
NAME
PARTIAL_LINK_TEXT
TAG_NAME
XPATH
Methods
public java.lang.StringgetType()

public static LocatorvalueOf(java.lang.String name)

public static Locatorvalues()

from java.lang.Enum<E>clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
from java.lang.ObjectgetClass, notify, notifyAll, wait, wait, wait

Enum Constants

CLASS_NAME

CSS_SELECTOR

ID

LINK_TEXT

NAME

PARTIAL_LINK_TEXT

TAG_NAME

XPATH

Methods

public static Locator values()

public static Locator valueOf(java.lang.String name)

public java.lang.String getType()

Source

/*
 * Copyright (C) 2015 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package androidx.test.espresso.web.webdriver;

/** Valid WebDriver locatorType types. */
public enum Locator {
  CLASS_NAME("className"),
  CSS_SELECTOR("css"),
  ID("id"),
  LINK_TEXT("linkText"),
  NAME("name"),
  PARTIAL_LINK_TEXT("partialLinkText"),
  TAG_NAME("tagName"),
  XPATH("xpath");

  private final String type;

  Locator(String type) {
    this.type = type;
  }

  static Locator forType(String type) {
    if (CLASS_NAME.getType().equals(type)) {
      return CLASS_NAME;
    }
    if (CSS_SELECTOR.getType().equals(type)) {
      return CSS_SELECTOR;
    }
    if (ID.getType().equals(type)) {
      return ID;
    }
    if (LINK_TEXT.getType().equals(type)) {
      return LINK_TEXT;
    }
    if (NAME.getType().equals(type)) {
      return NAME;
    }
    if (PARTIAL_LINK_TEXT.getType().equals(type)) {
      return PARTIAL_LINK_TEXT;
    }
    if (TAG_NAME.getType().equals(type)) {
      return TAG_NAME;
    }
    if (XPATH.getType().equals(type)) {
      return XPATH;
    }
    throw new IllegalStateException("No Locator enum found for a given type: " + type);
  }

  public String getType() {
    return type;
  }
}