Class Widget
- java.lang.Object
-
- ru.tinkoff.qa.neptune.selenium.api.widget.Widget
-
- All Implemented Interfaces:
org.openqa.selenium.SearchContext
,org.openqa.selenium.WrapsElement
,HasAttribute
,HasCssValue
,HasLocation
,HasRectangle
,HasSize
,HasTextContent
,IsEnabled
,IsVisible
- Direct Known Subclasses:
Button
,CalendarRangeWidget
,CalendarWidget
,ElementGroup
,Flag
,Form
,Image
,Link
,MultiSelect
,Select
,Tab
,Table
,TableCell
,TableFooter
,TableHeader
,TableRow
,TextElement
,TextField
public abstract class Widget extends Object implements org.openqa.selenium.WrapsElement, org.openqa.selenium.SearchContext, HasAttribute, IsEnabled, IsVisible, HasSize, HasRectangle, HasLocation, HasCssValue, HasTextContent
This class is designed to represent hierarchical structure of related elements. It is expected that there should be some top-level element from which other elements can be found.
-
-
Constructor Summary
Constructors Constructor Description Widget(org.openqa.selenium.WebElement wrappedElement)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.openqa.selenium.WebElement
findElement(org.openqa.selenium.By by)
List<org.openqa.selenium.WebElement>
findElements(org.openqa.selenium.By by)
String
getAttribute(String attribute)
Taken from documentation of SeleniumString
getCssValue(String propertyName)
Taken from documentation of Selenium:protected org.openqa.selenium.WebDriver
getDriver()
Returns wrapped WebDriverorg.openqa.selenium.Point
getLocation()
Where on the page is the top left-hand corner of the rendered element?org.openqa.selenium.Rectangle
getRect()
org.openqa.selenium.Dimension
getSize()
It is the width and height of the rendered elementorg.openqa.selenium.WebElement
getWrappedElement()
boolean
isEnabled()
boolean
isVisible()
protected org.openqa.selenium.JavascriptExecutor
js()
Returns wrapped js executorWidget
selfReference()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ru.tinkoff.qa.neptune.selenium.api.widget.HasTextContent
getText
-
-
-
-
Method Detail
-
findElements
public List<org.openqa.selenium.WebElement> findElements(org.openqa.selenium.By by)
- Specified by:
findElements
in interfaceorg.openqa.selenium.SearchContext
-
findElement
public org.openqa.selenium.WebElement findElement(org.openqa.selenium.By by)
- Specified by:
findElement
in interfaceorg.openqa.selenium.SearchContext
-
getWrappedElement
public org.openqa.selenium.WebElement getWrappedElement()
- Specified by:
getWrappedElement
in interfaceorg.openqa.selenium.WrapsElement
-
getDriver
protected org.openqa.selenium.WebDriver getDriver()
Returns wrapped WebDriver- Returns:
- wrapped WebDriver
-
js
protected org.openqa.selenium.JavascriptExecutor js()
Returns wrapped js executor- Returns:
- wrapped js executor
-
getLocation
public org.openqa.selenium.Point getLocation()
Description copied from interface:HasLocation
Where on the page is the top left-hand corner of the rendered element?- Specified by:
getLocation
in interfaceHasLocation
- Returns:
- A point, containing the location of the top left-hand corner of the element
-
getSize
public org.openqa.selenium.Dimension getSize()
Description copied from interface:HasSize
It is the width and height of the rendered element
-
getRect
public org.openqa.selenium.Rectangle getRect()
- Specified by:
getRect
in interfaceHasRectangle
- Returns:
- The location and size of the rendered element
-
getAttribute
public String getAttribute(String attribute)
Description copied from interface:HasAttribute
Taken from documentation of SeleniumGet the value of the given attribute of the element. Will return the current value, even if this has been modified after the page has been loaded.
More exactly, this method will return the value of the property with the given name, if it exists. If it does not, then the value of the attribute with the given name is returned. If neither exists, null is returned.
The "style" attribute is converted as best can be to a text representation with a trailing semi-colon.
The following are deemed to be "boolean" attributes, and will return either "true" or null:
async, autofocus, autoplay, checked, compact, complete, controls, declare, defaultchecked, defaultselected, defer, disabled, draggable, ended, formnovalidate, hidden, indeterminate, iscontenteditable, ismap, itemscope, loop, multiple, muted, nohref, noresize, noshade, novalidate, nowrap, open, paused, pubdate, readonly, required, reversed, scoped, seamless, seeking, selected, truespeed, willvalidate
Finally, the following commonly mis-capitalized attribute/property names are evaluated as expected:
- If the given name is "class", the "className" property is returned.
- If the given name is "readonly", the "readOnly" property is returned.
- Specified by:
getAttribute
in interfaceHasAttribute
- Parameters:
attribute
- The name of the attribute.- Returns:
- The attribute/property's current value or null if the value is not set.
-
getCssValue
public String getCssValue(String propertyName)
Description copied from interface:HasCssValue
Taken from documentation of Selenium:Get the value of a given CSS property. Color values should be returned as rgba strings, so, for example if the "background-color" property is set as "green" in the HTML source, the returned value will be "rgba(0, 255, 0, 1)". Note that shorthand CSS properties (e.g. background, font, border, border-top, margin, margin-top, padding, padding-top, list-style, outline, pause, cue) are not returned, in accordance with the DOM CSS2 specification - you should directly access the longhand properties (e.g. background-color) to access the desired values.
- Specified by:
getCssValue
in interfaceHasCssValue
- Parameters:
propertyName
- the css property name of the element- Returns:
- The current, computed value of the property.
-
isVisible
public boolean isVisible()
-
isEnabled
public boolean isEnabled()
-
selfReference
public Widget selfReference()
-
-