SingleBrowserPath

public final class SingleBrowserPath implements Path

An implementation of Path that is tailored to a singleton browser, thus allows some additional API’s for actions (for those who favor object-oriented API style)

Fields

anchor

public static final SingleBrowserPath anchor

body

public static final SingleBrowserPath body

button

public static final SingleBrowserPath button

div

public static final SingleBrowserPath div

element

public static final SingleBrowserPath element

form

public static final SingleBrowserPath form

header1

public static final SingleBrowserPath header1

header2

public static final SingleBrowserPath header2

header3

public static final SingleBrowserPath header3

header4

public static final SingleBrowserPath header4

header5

public static final SingleBrowserPath header5

header6

public static final SingleBrowserPath header6

html

public static final SingleBrowserPath html

input

public static final SingleBrowserPath input

listItem

public static final SingleBrowserPath listItem

section

public static final SingleBrowserPath section

span

public static final SingleBrowserPath span

svg

public static final SingleBrowserPath svg

unorderedList

public static final SingleBrowserPath unorderedList

Constructors

SingleBrowserPath

public SingleBrowserPath(BasicPath path)

Methods

after

public Path after(Path another)

afterSibling

public Path afterSibling(Path another)

ancestorOf

public Path ancestorOf(Path another)

and

public Path and(ElementProperty... prop)

before

public Path before(Path another)

beforeSibling

public Path beforeSibling(Path another)

childOf

public Path childOf(Path another)

click

public void click()

click at the location of this element

containing

public Path containing(Path another)

contains

public Path contains(Path another)

descendantOf

public Path descendantOf(Path another)

describedBy

public Path describedBy(String description)

doubleClick

public void doubleClick()

doubleclick at the location of this element

dragAndDrop

public Operations.DragAndDrop dragAndDrop()

drag and drop this element, to another element or another location. Examples:

element.dragAndDrop().to(anotherElement);
   element.dragAndDrop().to(50, 50);
Returns:DragAndDrop instance. See examples for usage.

find

public WebElement find()

Find the (first) element in the browser for this path

Returns:the WebElement

findAll

public List<WebElement> findAll()

Find all elements in the browser with this path

Returns:a list of all WebElements with this path

getAlternateXPath

public Optional<String> getAlternateXPath()

getDescribedBy

public Optional<String> getDescribedBy()

getElementProperties

public List<ElementProperty> getElementProperties()

getUnderlyingSource

public Optional<WebElement> getUnderlyingSource()

getXPath

public Optional<String> getXPath()

getXpathExplanation

public Optional<String> getXpathExplanation()

hover

public void hover()

hover over the element with this path in the browser

immediatelyAfterSibling

public Path immediatelyAfterSibling(Path another)

immediatelyBeforeSibling

public Path immediatelyBeforeSibling(Path another)

inside

public Path inside(Path another)

insideTopLevel

public Path insideTopLevel()

or

public Path or(Path another)

parentOf

public Path parentOf(Path another)

rightClick

public void rightClick()

right click at the location of this element

scrollTo

public WebElement scrollTo()

scroll the browser until this element is visible

Returns:the WebElement that was scrolled to

sendKeys

public void sendKeys(CharSequence... charsToSend)

send keys to element

Parameters:
  • charsToSend – the keys to send. Examples:
input.sendKeys("abc"); input.sendKeys("a", "bc");
Throws:

that

public Path that(ElementProperty... prop)

toString

public String toString()

withClass

public Path withClass(String cssClass)

withClasses

public Path withClasses(String... cssClasses)

withGlobalIndex

public Path withGlobalIndex(Integer index)

withText

public Path withText(String txt)

withTextContaining

public Path withTextContaining(String txt)