Package dev.comfast.cf
Interface CfLocator
- All Known Implementing Classes:
CfAbstractLocator,FoundElement,SeleniumLocator
public interface CfLocator
-
Method Summary
Modifier and TypeMethodDescriptionget sub-locator related to current onevoidclear()Clear given input/textarea/select/checkboxvoidclick()Click on elementintcount()voidDrag current element onto other elementExecutes JavaScript code, where "this" is current elementbooleanexists()voidfocus()Focus on element using JSgetAttribute(String name) getCssValue(String name) getText()getValue()booleanvoidhover()Hover mouse on elementboolean<T> List<T>Does mapping against each element found by locatornth(int nth) nth element found by locatorvoidsetChecked(boolean state) Check/uncheck checkboxvoidGeneric set value of element.voidtap()Tap gesture on elementvoidType keys into element
-
Method Details
-
$
get sub-locator related to current one- Returns:
- Cfloctor
-
hasClass
- Parameters:
cssClass- name- Returns:
- if element have given css class
-
getText
String getText()- Returns:
- text of element
-
innerHtml
String innerHtml()- Returns:
- inner html of element
-
outerHtml
String outerHtml()- Returns:
- outer html of element
-
getValue
String getValue()- Returns:
- value of element
-
getAttribute
- Returns:
- javascript attribute of element
-
getCssValue
- Parameters:
name- eg. color, opacity, etc.- Returns:
- css value of given name
-
exists
boolean exists()- Returns:
- true if element exists in DOM
-
getTagName
String getTagName()- Returns:
- html tag name
-
isDisplayed
boolean isDisplayed()- Returns:
- true if element is visible, not throw if element not found - just return false
-
click
void click()Click on element -
tap
void tap()Tap gesture on element -
focus
void focus()Focus on element using JS -
hover
void hover()Hover mouse on element -
dragTo
Drag current element onto other element -
setValue
Generic set value of element. Should work on input, textarea, select, etc.- Parameters:
value- to set
-
setChecked
void setChecked(boolean state) Check/uncheck checkbox- Parameters:
state- true- check, false - uncheck
-
clear
void clear()Clear given input/textarea/select/checkbox -
type
Type keys into element- Parameters:
keys- keyboard input, can use special keys in format: {Ctrl}, {Ctrl+Shift+L}, {Shift+some text} etc.
-
count
int count()- Returns:
- number of elements found by locator
-
executeJs
Executes JavaScript code, where "this" is current element- Parameters:
script- JS Codeargs- arguments for JS code- Returns:
- result of JS code
-
map
Does mapping against each element found by locator- Type Parameters:
T- mapping result type- Parameters:
func- mapping function, eg. locator -> locator.getText()- Returns:
- list of mapped values
-
nth
nth element found by locator- Parameters:
nth- index starting of 1- Returns:
- CfLocator
-