class WebContext extends WebElementLocator with LazyLogging
The web context. All web driver interactions happen here (and will do nothing when --dry-run is enabled).
- Alphabetic
- By Inheritance
- WebContext
- WebElementLocator
- LazyLogging
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new WebContext(env: WebEnvContext, driverManager: DriverManager)
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
asertVisuals(): Unit
Performs a visual check of all checkpoints in current eyes session.
- def captureCurrentUrl(asName: Option[String]): Unit
-
def
captureScreenshot(unconditional: Boolean): Unit
Captures and the current screenshot and adds it to the attachments list.
-
def
checkElementState(elementBinding: LocatorBinding, state: String, negate: Boolean): Unit
Checks the current state of an element.
Checks the current state of an element.
- elementBinding
the locator binding of the element
- state
the state to check
- negate
whether or not to negate the check
-
def
checkVisual(checkpoint: String, fullPage: Boolean, matchLevel: Option[MatchLevel]): Unit
Performs a visual checkpoint of the contents in the current browser window.
Performs a visual checkpoint of the contents in the current browser window.
- checkpoint
the checkpoint name
- fullPage
true to capture full page, false otherwise
- matchLevel
optional match Level
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
close(name: String): Unit
Closes a named browser and associated web driver.
-
def
close(): Unit
Closes all browsers and associated web drivers (if any have loaded).
-
def
closeChild(): Unit
Closes the child window.
-
def
deselectByIndex(elementBinding: LocatorBinding, index: Int): Unit
Deselects a value in a dropdown (select control) by index.
Deselects a value in a dropdown (select control) by index.
- elementBinding
the web element locator binding
- index
the index to select (first index is 0)
-
def
deselectByValue(elementBinding: LocatorBinding, value: String): Unit
Deselects a value in a dropdown (select control) by value.
Deselects a value in a dropdown (select control) by value.
- elementBinding
the web element locator binding
- value
the value to select
-
def
deselectByVisibleText(elementBinding: LocatorBinding, value: String): Unit
Deselects a value in a dropdown (select control) by visible text.
Deselects a value in a dropdown (select control) by visible text.
- elementBinding
the web element locator binding
- value
the value to select
- def dragAndDrop(sourceBinding: LocatorBinding, targetBinding: LocatorBinding): Unit
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
executeJS(javascript: String, params: Any*)(implicit takeScreenShot: Boolean = false): Any
Injects and executes a javascript on the current page through web driver.
Injects and executes a javascript on the current page through web driver.
- javascript
the script expression to execute
- params
optional parameters to the script
- takeScreenShot
true to take screenshot after performing the function
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
getCachedWebElement(element: String): Option[WebElement]
Gets a cached web element.
Gets a cached web element.
- element
the name of the web element
- returns
the cached web element
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
getElementSelection(name: String, selection: String): Option[String]
Gets an element's selected value(s).
Gets an element's selected value(s).
- name
the name of the element
- selection
textto get selected option text,valueto get selected option value- returns
the selected value or a comma seprated string containing all the selected values if multiple values are selected.
-
def
getElementText(elementBinding: LocatorBinding): Option[String]
Gets the text value of a web element on the current page.
Gets the text value of a web element on the current page. A search for the text is made in the following order and the first value found is returned:
- Web element text
- Web element text attribute
- Web element value attribute
If a value is found, its value is bound to the current page
scope as
name/text.
- elementBinding
the web element locator binding
-
def
getLocatorBinding(element: String): LocatorBinding
Gets a web element binding.
Gets a web element binding.
- element
the name of the web element
-
def
getPopupMessage: String
Gets the message of an alert of confirmation popup.
Gets the message of an alert of confirmation popup.
- returns
the alert or confirmation message
-
def
getTitle: String
Gets the title of the current page in the browser.
-
def
handleAlert(accept: Boolean): Unit
Handles an alert (pop-up)
Handles an alert (pop-up)
- accept
true to accept; false to dismiss
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
highlightElement(element: WebElement): Unit
Highlights and then un-highlights a browser element.
Highlights and then un-highlights a browser element. Uses pure javascript, as suggested by https://github.com/alp82. The duration of the highlight lasts for
gwen.web.throttle.msecs. The look and feel of the highlight is controlled by thegwen.web.highlight.stylesetting.- element
the element to highlight
- def holdAndClick(modifierKeys: Array[String], clickAction: String, elementBinding: LocatorBinding): Unit
-
def
isDisplayed(webElement: WebElement): Boolean
Checks if an element is displayed.
-
def
isInViewport(webElement: WebElement): Boolean
Checks if an element is not in the view port.
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
locateAndHighlight(elementBinding: LocatorBinding): Unit
Locates a web element and highlights it.
Locates a web element and highlights it.
- elementBinding
the web element locator binding
-
lazy val
logger: Logger
- Attributes
- protected
- Definition Classes
- LazyLogging
- Annotations
- @transient()
-
def
maximizeWindow(): Unit
Maximizes the browser window.
- def moveToAndCapture(driver: WebDriver, webElement: WebElement): Unit
-
def
navigateTo(url: String): Unit
Navigates the browser the given URL
Navigates the browser the given URL
- url
the URL to navigate to
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
newOrCurrentSession(): Unit
Starts a new session if there isn't one or stays in the current one.
-
def
noOfSessions(): Int
Gets the number of open sesions.
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def performAction(action: String, elementBinding: LocatorBinding): Unit
-
def
performActionInContext(action: String, element: String, context: String): Unit
Performs and action on a web element in the context of another element.
Performs and action on a web element in the context of another element.
- action
description of the action
- element
the name of the element to perform the action on
- context
the name of the context element binding to find the element in
-
def
refreshPage(): Unit
Refreshes the current page.
-
def
reset(): Unit
Resets the driver context.
-
def
resizeWindow(width: Int, height: Int): Unit
Resizes the browser window to the given dimensions.
Resizes the browser window to the given dimensions.
- width
the width
- height
the height
-
def
scrollIntoView(webElement: WebElement, scrollTo: ScrollTo.Value): Unit
Scrolls the given web element into view.
Scrolls the given web element into view.
- webElement
the web element to scroll to
- scrollTo
scroll element into view, options are: top or bottom
-
def
scrollIntoView(elementBinding: LocatorBinding, scrollTo: ScrollTo.Value): Unit
Scrolls an element into view.
Scrolls an element into view.
- elementBinding
the web element locator binding
- scrollTo
scroll element into view, options are: top or bottom
-
def
selectByIndex(elementBinding: LocatorBinding, index: Int): Unit
Selects a value in a dropdown (select control) by index.
Selects a value in a dropdown (select control) by index.
- elementBinding
the web element locator binding
- index
the index to select (first index is 0)
-
def
selectByValue(elementBinding: LocatorBinding, value: String): Unit
Selects a value in a dropdown (select control) by value.
Selects a value in a dropdown (select control) by value.
- elementBinding
the web element locator binding
- value
the value to select
-
def
selectByVisibleText(elementBinding: LocatorBinding, value: String): Unit
Selects a value in a dropdown (select control) by visible text.
Selects a value in a dropdown (select control) by visible text.
- elementBinding
the web element locator binding
- value
the value to select
- def sendKeys(elementBinding: LocatorBinding, keysToSend: Array[String]): Unit
-
def
sendValue(elementBinding: LocatorBinding, value: String, clearFirst: Boolean, sendEnterKey: Boolean): Unit
Sends a value to a web element (one character at a time).
Sends a value to a web element (one character at a time).
- elementBinding
the web element locator binding
- value
the value to send
- clearFirst
true to clear field first (if element is a text field)
- sendEnterKey
true to send the Enter key after sending the value
-
def
startVisualTest(testName: String, viewportSize: Option[RectangleSize]): Unit
Starts a visual text.
Starts a visual text.
- testName
the name of the visual test
- viewportSize
optional viewport size
-
def
switchToChild(): Unit
Switches to the child window if one was just opened.
-
def
switchToDefaultContent(): Unit
Switches to the top window / first frame
-
def
switchToParent(childClosed: Boolean): Unit
Switches to the parent window.
-
def
switchToSession(session: String): Unit
Switches the web driver session
Switches the web driver session
- session
the name of the session to switch to
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
- def tryMoveTo(webElement: WebElement): Unit
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
waitForElementState(elementBinding: LocatorBinding, state: String, negate: Boolean): Unit
Waits the state of an element.
Waits the state of an element.
- elementBinding
the locator binding of the element
- state
the state to wait for
- negate
whether or not to negate the check
-
def
waitForText(elementBinding: LocatorBinding): Boolean
Waits for text to appear in the given web element.
Waits for text to appear in the given web element.
- elementBinding
the web element locator binding
-
def
waitUntil(timeoutSecs: Long)(condition: ⇒ Boolean): Unit
Waits until a given condition is ready for a given number of seconds.
Waits until a given condition is ready for a given number of seconds. Errors on given timeout out seconds.
- timeoutSecs
the number of seconds to wait before timing out
- condition
the boolean condition to wait for (until true)
-
def
waitUntil(condition: ⇒ Boolean): Unit
Waits for a given condition to be true.
Waits for a given condition to be true. Errors on time out after "gwen.web.wait.seconds" (default is 10 seconds)
- condition
the boolean condition to wait for (until true)
-
def
withWebDriver[T](function: (WebDriver) ⇒ T)(implicit takeScreenShot: Boolean = false): Option[T]
Invokes a function that performs an operation on the current web driver session and conditionally captures the current screenshot if the specified takeScreenShot is true.
Invokes a function that performs an operation on the current web driver session and conditionally captures the current screenshot if the specified takeScreenShot is true.
- function
the function to perform
- takeScreenShot
true to take screenshot after performing the function