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

java.lang.Object
  extended by com.atlassian.jira.webtest.framework.impl.selenium.core.SeleniumContextAware
      extended by com.atlassian.jira.webtest.framework.impl.selenium.locator.AbstractSeleniumLocator
All Implemented Interfaces:
Locator, LocatorData, SeleniumLocator

public abstract class AbstractSeleniumLocator
extends SeleniumContextAware
implements Locator, SeleniumLocator

Abstract Selenium locator implementation. Implements location functionality by using standard Selenium location syntax. Uses default locator mappings defined in the framework API.

Since:
v4.2

Field Summary
protected  com.atlassian.jira.webtest.framework.impl.selenium.locator.SeleniumElement element
           
protected  LocatorData locatorData
           
 
Fields inherited from class com.atlassian.jira.webtest.framework.impl.selenium.core.SeleniumContextAware
assertThat, client, context, timeouts
 
Constructor Summary
protected AbstractSeleniumLocator(SeleniumContext ctx, LocatorData locatorData)
           
protected AbstractSeleniumLocator(SeleniumContext ctx, LocatorData locatorData, Timeouts defTimeout)
           
protected AbstractSeleniumLocator(SeleniumContext ctx, LocatorType locatorType, String value)
           
protected AbstractSeleniumLocator(SeleniumContext ctx, LocatorType locatorType, String value, Timeouts defTimeout)
           
 
Method Summary
 String bareLocator()
          Returns Selenium compatible locator, without the prefix (it is NOT always equal to LocatorData.value().
 SeleniumLocator combine(Locator toNest)
           Given toNest, return a new locator that represents an element located by toNest and nested within the element represented by this locator.
 Timeouts defaultTimeout()
          Default timeout for the timed conditions of this locator's element.
 Element element()
           Retrieve element corresponding to this locator.
 boolean equals(Object obj)
           
 int hashCode()
           
 boolean supports(Locator other)
           Verify if the other locator is supported by this locator.
 String toString()
           
 LocatorType type()
          Type of the locator.
 String value()
          Value of the locator, used to query and manipulate it in the current test context.
 
Methods inherited from class com.atlassian.jira.webtest.framework.impl.selenium.core.SeleniumContextAware
context
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.atlassian.jira.webtest.framework.impl.selenium.locator.SeleniumLocator
fullLocator, withDefaultTimeout
 

Field Detail

locatorData

protected final LocatorData locatorData

element

protected final com.atlassian.jira.webtest.framework.impl.selenium.locator.SeleniumElement element
Constructor Detail

AbstractSeleniumLocator

protected AbstractSeleniumLocator(SeleniumContext ctx,
                                  LocatorType locatorType,
                                  String value)

AbstractSeleniumLocator

protected AbstractSeleniumLocator(SeleniumContext ctx,
                                  LocatorType locatorType,
                                  String value,
                                  Timeouts defTimeout)

AbstractSeleniumLocator

protected AbstractSeleniumLocator(SeleniumContext ctx,
                                  LocatorData locatorData)

AbstractSeleniumLocator

protected AbstractSeleniumLocator(SeleniumContext ctx,
                                  LocatorData locatorData,
                                  Timeouts defTimeout)
Method Detail

type

public final LocatorType type()
Description copied from interface: LocatorData
Type of the locator.

Specified by:
type in interface LocatorData
Returns:
type of the locator
See Also:
LocatorType

value

public final String value()
Description copied from interface: LocatorData
Value of the locator, used to query and manipulate it in the current test context.

Specified by:
value in interface LocatorData
Returns:
value of the locator instance represented by this data

element

public final Element element()
Description copied from interface: Locator

Retrieve element corresponding to this locator.

In case the locator locates more then one element, implementations are allowed to:

In most cases locating more than one element is a either a mistake on the side of test developer, or a result of an invalid page (e.g. two elements with the same ID).

Specified by:
element in interface Locator
Returns:
element this locator on a page in the current test context

supports

public final boolean supports(Locator other)
Description copied from interface: Locator

Verify if the other locator is supported by this locator. This means that other may be used in the Locator.combine(com.atlassian.jira.webtest.framework.core.locator.Locator) method of this locator.

This usually involves type compatibility between the locators and optionally compatibility of the particular locator instances in the current test context.

Example: a jQuery locator would possibly return true for another jQuery locator, as well as an id and a class locator, but might return false for an xpath locator, unless it is a very sophisticated implementation capable of translating xpath into jQuery/css.

Specified by:
supports in interface Locator
Parameters:
other - the other locator checked for compatibility
Returns:
true, if this locator instance is compatible with the other in the current context

combine

public final SeleniumLocator combine(Locator toNest)
Description copied from interface: Locator

Given toNest, return a new locator that represents an element located by toNest and nested within the element represented by this locator.

toNest must be compatible with this locator, which may be examined by means of the Locator.supports(com.atlassian.jira.webtest.framework.core.locator.Locator) method.

Specified by:
combine in interface Locator
Specified by:
combine in interface SeleniumLocator
Parameters:
toNest - locator to nest within this locator
Returns:
new locator representing the nested locator. Most likely (but not necessarily) it will have the same type as this locator
See Also:
Locator.combine(com.atlassian.jira.webtest.framework.core.locator.Locator)

bareLocator

public String bareLocator()
Description copied from interface: SeleniumLocator
Returns Selenium compatible locator, without the prefix (it is NOT always equal to LocatorData.value().

Specified by:
bareLocator in interface SeleniumLocator
Returns:
Selenium locator value without prefix

defaultTimeout

public Timeouts defaultTimeout()
Description copied from interface: SeleniumLocator
Default timeout for the timed conditions of this locator's element.

Specified by:
defaultTimeout in interface SeleniumLocator
Returns:
default timeout

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2002-2012 Atlassian. All Rights Reserved.