com.atlassian.jira.webtest.framework.impl.selenium.locator
Class StringLocators

java.lang.Object
  extended by com.atlassian.jira.webtest.framework.impl.selenium.locator.StringLocators

public final class StringLocators
extends Object

String locator support for Selenium.

Locators in the Selenium World™ come with a simple syntax: type=value. This class is a suite of static utilities to help with various conversions and manipulations of such locators.

Since:
v4.3

Method Summary
 String addPrefixIfNecessary(LocatorType type, String locator)
          Add this locator's prefix to locator string if necessary (i.e.
static String create(LocatorData locatorData)
          Create Selenium string locator from an arbitrary locatorData.
static String create(LocatorType type, String value)
          Create Selenium string locator from given locator type and value.
static Locators fromLocator(String locator)
          Resolve locator instance from locator string.
static boolean hasLocatorPrefix(String locator)
           
static boolean matches(Locators locatorType, String locator)
          Check if locator matches given locatorType.
static boolean matchesAnyType(String locatorPrefix)
           
static String removeLocatorPrefix(String locator)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

create

public static String create(LocatorType type,
                            String value)
Create Selenium string locator from given locator type and value.

Parameters:
type - type of locator
value - value of locator
Returns:
Selenium-compatible locator string

create

public static String create(LocatorData locatorData)
Create Selenium string locator from an arbitrary locatorData.

Parameters:
locatorData - locator data representing a locator to create from
Returns:
Selenium-compatible locator string
See Also:
create(com.atlassian.jira.webtest.framework.core.locator.LocatorType, String)

removeLocatorPrefix

public static String removeLocatorPrefix(String locator)

hasLocatorPrefix

public static boolean hasLocatorPrefix(String locator)

fromLocator

public static Locators fromLocator(String locator)
Resolve locator instance from locator string.

Parameters:
locator - string containing any locator
Returns:
corresponding Locators instance
Throws:
IllegalArgumentException - if locator has no prefix, or could no corresponding SeleniumLocator instance exists.

matches

public static boolean matches(Locators locatorType,
                              String locator)
Check if locator matches given locatorType.

Parameters:
locatorType - locator type
locator - locator to check
Returns:
true, if locator matches locatorType

matchesAnyType

public static boolean matchesAnyType(String locatorPrefix)

addPrefixIfNecessary

public final String addPrefixIfNecessary(LocatorType type,
                                         String locator)
Add this locator's prefix to locator string if necessary (i.e. the locator is not prefixed yet).

Parameters:
type - locator type
locator - locator to transform
Returns:
prefixed locator (if not yet prefixed)


Copyright © 2002-2013 Atlassian. All Rights Reserved.