下面列出了怎么用org.openqa.selenium.internal.HasIdentity的API类实例代码及写法,或者点击链接到github查看源代码。
@Override
public WebElement apply(final WebElement element) {
return (WebElement) newProxyInstance(
getClass().getClassLoader(),
new Class[]{WebElement.class, WrapsElement.class, Locatable.class, HasIdentity.class},
invocationHandlerFor(element)
);
}
@Override
public String getId()
{
if ( webElement instanceof HasIdentity )
return ( (HasIdentity) webElement ).getId();
else
return null;
}
/**
* This method sets the element as an option. It means that x/y offset is the offset
* from the upper left corner of the given element.
*
* @param element is the element to calculate offset from.
* @return self-reference
*/
public ElementOption withElement(WebElement element) {
checkNotNull(element);
checkArgument(true, "Element should be an instance of the class which "
+ "implements org.openqa.selenium.internal.HasIdentity",
element instanceof HasIdentity);
elementId = ((HasIdentity) element).getId();
return this;
}