InBrowserSinglton¶
-
public final class
InBrowserSinglton
¶ A simplified API built to interact with a single instance of a running browser. See
com.github.loyada.jdollarx.InBrowser
for an API that supports multiple browser instances.
Methods¶
clickAt¶
clickOn¶
contextClick¶
doubleClickOn¶
dragAndDrop¶
-
public static Operations.DragAndDrop
dragAndDrop
(Path path)¶ Drag and drop in the browser. Several flavors of use:
dragAndDrop(source).to(target); dragAndDrop(source).to(xCor, yCor);
Parameters: - path – the path of the element to drag and drop
Returns: a DragAndDrop instance that allows to drag and drop to another element or to another location
find¶
-
public static WebElement
find
(Path el)¶ Equivalent to WebDriver.findElement(). If the Path contains a WebElement than it will look for an element inside that WebElement. Otherwise it looks starting at the top level. It also alters the xpath if needed to search from top level correctly.
Parameters: - el – a Path instance
Returns: returns a WebElement or throws an ElementNotFoundException
findAll¶
-
public static List<WebElement>
findAll
(Path el)¶ Equivalent to WebDriver.findElements(). If the Path contains a WebElement than it will look for an element inside that WebElement. Otherwise it looks starting at the top level. It also alters the xpath if needed to search from top level correctly.
Parameters: - el – a Path instance
Returns: a list of WebElements.
getCssClasses¶
getSelect¶
-
public static Select
getSelect
(Path el)¶ Get a Selenium select element, which provides a high level API to interacting with a “select” menu. Since the Selenium API is good enough, there was no need to create a specialized dollarx version.
Parameters: - el –
- must be a “select” path, with “option” elements for the various selectable options.
Returns: org.openqa.selenium.support.ui.Select instance
- el –
hoverOver¶
isDisplayed¶
isEnabled¶
isPresent¶
isSelected¶
numberOfAppearances¶
pressKeyDown¶
-
public static Operations.KeysDown
pressKeyDown
(CharSequence thekey)¶ Press key down in the browser, or on a specific element. Two flavors of use:
pressKeyDown(Keys.TAB).inBrowser(); pressKeyDown(Keys.TAB).on(path);
Parameters: - thekey – the key to press
Returns: a KeysDown instance that allows to send to the browser in general or to a specific element in the DOM. See example.
releaseKey¶
-
public static Operations.ReleaseKey
releaseKey
(CharSequence thekey)¶ Release key in the browser, or on a specific element. Two flavors of use:
releaseKey(Keys.TAB).inBrowser(); releaseKey(Keys.TAB).on(path);
Parameters: - thekey – the key to release
Returns: a ReleaseKey instance that allows to send to the browser in general or to a specific element in the DOM. See example.
rightClick¶
scroll¶
-
public static Operations.Scroll
scroll
()¶ scroll the browser. Several flavors of use:
browser.scroll().to(path); browser.scroll().left(50); browser.scroll().right(50); browser.scroll().up(50); browser.scroll().down(50);
Returns: a Scroll instance that allows to scroll by offset or to a location of a DOM element
scrollElement¶
-
public static Operations.ScrollElement
scrollElement
(Path el)¶ scroll within the given element. Useful especially when working with grids.
Parameters: - el – a Path instance
Returns: the WebElement found
scrollElementWithStepOverride¶
-
public static Operations.ScrollElement
scrollElementWithStepOverride
(Path el, int step)¶ scroll within the given element. Useful especially when working with grids.
Parameters: - el – a Path instance
- step – step size override
Returns: the WebElement found
scrollTo¶
sendKeys¶
-
public static Operations.KeysSender
sendKeys
(CharSequence... charsToSend)¶ send keys to the browser, or to a specific element. Two flavors of use:
sendKeys("abc").toBrowser(); sendKeys("abc").to(path);
Parameters: - charsToSend – the keys to send. Can be “abc”, or “a”, “b”, “c”
Returns: a KeySender instance that allows to send to the browser in general or to a specific element in the DOM