Package dev.comfast.cf.se
Class SeleniumLocator
java.lang.Object
dev.comfast.cf.CfAbstractLocator
dev.comfast.cf.se.SeleniumLocator
- All Implemented Interfaces:
CfLocator
- Direct Known Subclasses:
FoundElement
-
Field Summary
Fields inherited from class dev.comfast.cf.CfAbstractLocator
chain -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSeleniumLocator(SelectorChain chain) SeleniumLocator(String selector, Object... params) -
Method Summary
Modifier and TypeMethodDescriptionget sub-locator related to current onevoidclear()Clear given input/textarea/select/checkboxvoidclick()Click on elementintcount()protected ObjectdoExecuteJs(String script, Object... args) Execute JS, where variable: el ===> current elementprotected org.openqa.selenium.WebElementdoFind()protected Optional<org.openqa.selenium.WebElement>voidUses javaScript implementation.Executes JavaScript code, where "this" is current elementbooleanexists()find()Force find action.voidfocus()Focus on element using JSvoidforEach(Consumer<CfFoundLocator> func) Iterate thorough all elements matched by locatorgetAttribute(String name) getCssValue(String name) voidhover()Hover mouse on elementboolean<T> List<T>map(Function<CfFoundLocator, T> func) Does mapping against each element found by locatornth(int nth) nth element found by locatorvoidsetChecked(boolean state) Check/uncheck checkboxvoidGeneric set value of element.voidWait for given condition matchvoidtap()Tap gesture on elementtryFind()Force find action, doesn't throw exception.voidType keys into elementvoidWait for given function return truth value (true, 1, non null object etc.)Methods inherited from class dev.comfast.cf.CfAbstractLocator
action, action, action, canEqual, equals, getText, getValue, hasClass, hashCode, innerHtml, outerHtml, toString
-
Constructor Details
-
SeleniumLocator
-
SeleniumLocator
-
-
Method Details
-
$
Description copied from interface:CfLocatorget sub-locator related to current one -
find
Description copied from interface:CfLocatorForce find action. If you want only check existence of element useCfLocator.exists()method. -
tryFind
Description copied from interface:CfLocatorForce find action, doesn't throw exception. If you want only check existence of element useCfLocator.exists()method. -
getAttribute
- Specified by:
getAttributein interfaceCfLocator- Returns:
- javascript attribute of element
-
getCssValue
- Specified by:
getCssValuein interfaceCfLocator- Parameters:
name- eg. color, opacity, etc.- Returns:
- css value of given name
-
getTagName
- Specified by:
getTagNamein interfaceCfLocator- Returns:
- html tag name
-
exists
public boolean exists() -
isDisplayed
public boolean isDisplayed()- Specified by:
isDisplayedin interfaceCfLocator- Returns:
- true if element is visible, not throw if element not found - just return false
-
tap
public void tap()Description copied from interface:CfLocatorTap gesture on element -
click
public void click()Description copied from interface:CfLocatorClick on element -
focus
public void focus()Description copied from interface:CfLocatorFocus on element using JS -
hover
public void hover()Description copied from interface:CfLocatorHover mouse on element -
dragTo
Uses javaScript implementation. Works faster and more reliable -
setValue
Description copied from interface:CfLocatorGeneric set value of element. Should work on input, textarea, select, etc. -
setChecked
public void setChecked(boolean state) Description copied from interface:CfLocatorCheck/uncheck checkbox- Specified by:
setCheckedin interfaceCfLocator- Parameters:
state- true- check, false - uncheck
-
clear
public void clear()Description copied from interface:CfLocatorClear given input/textarea/select/checkbox -
type
Description copied from interface:CfLocatorType keys into element -
count
public int count() -
nth
Description copied from interface:CfLocatornth element found by locator -
waitFor
Description copied from interface:CfLocatorWait for given function return truth value (true, 1, non null object etc.)locator.waitFor(el -> el.count() > 0, 3000); locator.waitFor(el -> el.getText().equals("some text"), 60_000); -
should
Description copied from interface:CfLocatorWait for given condition match -
executeJs
Description copied from interface:CfLocatorExecutes JavaScript code, where "this" is current element -
map
Description copied from interface:CfLocatorDoes mapping against each element found by locator -
forEach
Description copied from interface:CfLocatorIterate thorough all elements matched by locator -
doExecuteJs
Execute JS, where variable: el ===> current element -
doFind
protected org.openqa.selenium.WebElement doFind() -
doTryFind
-