WebContext
The web evaluatioin context.
Value members
Concrete methods
Add a list of error attachments to the given step including the current screenshot and all current error attachments.
Add a list of error attachments to the given step including the current screenshot and all current error attachments.
- Value parameters:
- failure
the failed status
- Definition Classes
- EvalContext
Binds the given element and value to a given action (element/action=value) and then waits for any bound post conditions to be satisfied.
Binds the given element and value to a given action (element/action=value) and then waits for any bound post conditions to be satisfied.
- Value parameters:
- action
the action to bind the value to
- element
the element to bind the value to
- value
the value to bind
Captures an element screenshot and adds it to the attachments list.
Captures an element screenshot and adds it to the attachments list.
Captures the current screenshot and adds it to the attachments list.
Captures the current screenshot and adds it to the attachments list.
Checks the current state of an element.
Checks the current state of an element.
- Value parameters:
- binding
the locator binding of the element
- message
optional assertion error message
- negate
whether or not to negate the check
- state
the state to check
Closes the context and all browsers and associated web drivers (if any have loaded).
Closes the context and all browsers and associated web drivers (if any have loaded).
- Definition Classes
- Environment
Closes the tab or window occurrence.
Closes the tab or window occurrence.
- Value parameters:
- occurrence
the tag or window occurrence to close (primary is 0, first opened is occurrence 1, 2nd is 2, ..)
Gets the actual value of an attribute and compares it with an expected value or condition.
Gets the actual value of an attribute and compares it with an expected value or condition.
- Value parameters:
- actual
the actual value of the element
- expected
the expected value, regex, xpath, or json path
- message
optional error message to use
- name
the name of the attribute being compared
- nameSuffix
optional name suffix
- negate
true to negate the result
- operator
the comparison operator
- Returns:
true if the actual value matches the expected value
Deselects a value in a dropdown (select control) by index.
Deselects a value in a dropdown (select control) by index.
- Value parameters:
- binding
the locator binding
- index
the index to select (first index is 0)
Deselects a value in a dropdown (select control) by value.
Deselects a value in a dropdown (select control) by value.
- Value parameters:
- binding
the locator binding
- value
the value to select
Deselects a value in a dropdown (select control) by visible text.
Deselects a value in a dropdown (select control) by visible text.
- Value parameters:
- binding
the locator binding
- value
the value to select
Adds web engine dsl steps to super implementation. The entries returned by this method are used for tab completion in the REPL.
Adds web engine dsl steps to super implementation. The entries returned by this method are used for tab completion in the REPL.
- Definition Classes
- EvalContext
Executes a javascript expression on the current page through the web driver.
Executes a javascript expression on the current page through the web driver.
- Value parameters:
- javascript
the script expression to execute
- params
optional parameters to the script
- Definition Classes
- ScriptSupport
Injects and executes a javascript on the current page through web driver.
Injects and executes a javascript on the current page through web driver.
- Value parameters:
- javascript
the script expression to execute
- params
optional parameters to the script
- takeScreenShot
true to take screenshot after performing the function
Appends a return keyword in front of the given javascript expression in preparation for execute-with-return (since web driver requires return prefix).
Appends a return keyword in front of the given javascript expression in preparation for execute-with-return (since web driver requires return prefix).
- Value parameters:
- javascript
the javascript function
- Definition Classes
- ScriptSupport
Resolves a bound attribute value from the visible scope.
Resolves a bound attribute value from the visible scope.
- Value parameters:
- name
the name of the bound attribute to find
Gets a bound value from memory. A search for the value is made in the following order and the first value found is returned:
Gets a bound value from memory. A search for the value is made in the following order and the first value found is returned:
- Web element text on the current page
- Currently active page scope
- The top scope
- Settings
- Value parameters:
- name
the name of the bound value to find
- Definition Classes
- EvalContext
Gets a cached web element.
Gets a cached web element.
- Value parameters:
- element
the name of the web element
- Returns:
the cached web element
Gets an element's selected value(s).
Gets an element's selected value(s).
- Value parameters:
- 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.
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:
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.
- Value parameters:
- binding
the locator binding
Gets a named locator binding.
Gets a named locator binding.
- Value parameters:
- name
the name of the web element
Gets a named locator binding.
Gets a named locator binding.
- Value parameters:
- name
the name of the web element
- optional
true to return None if not found; false to throw error
Gets the message of an alert of confirmation popup.
Gets the message of an alert of confirmation popup.
- Returns:
the alert or confirmation message
Gets the title of the current page in the browser.
Gets the title of the current page in the browser.
Handles an alert (pop-up)
Handles an alert (pop-up)
- Value parameters:
- accept
true to accept; false to dismiss
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 the
gwen.web.highlight.style setting.
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 the
gwen.web.highlight.style setting.
- Value parameters:
- element
the element to highlight
Locates a web element and highlights it.
Locates a web element and highlights it.
- Value parameters:
- binding
the locator binding
Starts a new session if there isn't one or stays in the current one.
Starts a new session if there isn't one or stays in the current one.
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.
- Value parameters:
- action
description of the action
- context
the name of the context element binding to find the element in
- element
the name of the element to perform the action on
Resets the context for the given state level.
Resets the context for the given state level.
- Definition Classes
- Environment
Resizes the browser window to the given dimensions.
Resizes the browser window to the given dimensions.
- Value parameters:
- height
the height
- width
the width
Scrolls an element into view.
Scrolls an element into view.
- Value parameters:
- binding
the locator binding
- scrollTo
scroll element into view, options are: top or bottom
Scrolls the given web element into view.
Scrolls the given web element into view.
- Value parameters:
- scrollTo
scroll element into view, options are: top or bottom
- webElement
the web element to scroll to
Scrolls to the top of bottom of the current page.
Scrolls to the top of bottom of the current page.
- Value parameters:
- scrollTo
top or bottom
Selects a value in a dropdown (select control) by index.
Selects a value in a dropdown (select control) by index.
- Value parameters:
- binding
the locator binding
- index
the index to select (first index is 0)
Selects a value in a dropdown (select control) by value.
Selects a value in a dropdown (select control) by value.
- Value parameters:
- binding
the locator binding
- value
the value to select
Selects a value in a dropdown (select control) by visible text.
Selects a value in a dropdown (select control) by visible text.
- Value parameters:
- binding
the locator binding
- value
the value to select
Sends a value to a web element.
Sends a value to a web element.
- Value parameters:
- binding
the locator binding
- clearFirst
true to clear field first (if element is a text field)
- clickFirst
true to click field first (if element is a text field)
- sendEnterKey
true to send the Enter key after sending the value
- value
the value to send
Switches to the first child window if one was just opened.
Switches to the first child window if one was just opened.
Starts and switches to a new tab or window.
Starts and switches to a new tab or window.
- Value parameters:
- winType
tab or window
Switches the web driver session
Switches the web driver session
- Value parameters:
- session
the name of the session to switch to
Switches to a tab or window occurrence.
Switches to a tab or window occurrence.
- Value parameters:
- occurrence
the tag or window occurrence to switch to (primary is 0, first opened is occurrence 1, 2nd is 2, ..)
Waits the state of an element.
Waits the state of an element.
- Value parameters:
- binding
the locator binding of the element
- negate
whether or not to negate the check
- state
the state to wait for
Waits for text to appear in the given web element.
Waits for text to appear in the given web element.
- Value parameters:
- binding
the locator binding
Waits for a given condition to be true. Errors on time out after "gwen.web.wait.seconds" (default is 10 seconds)
Waits for a given condition to be true. Errors on time out after "gwen.web.wait.seconds" (default is 10 seconds)
- Value parameters:
- condition
the boolean condition to wait for (until true)
- reason
a description of what is being waited on
Waits until a given condition is ready for an optional number of seconds. Errors on given timeout out seconds.
Waits until a given condition is ready for an optional number of seconds. Errors on given timeout out seconds.
- Value parameters:
- condition
the boolean condition to wait for (until true)
- reason
a description of what is being waited on
- timeoutSecs
optional number of seconds to wait before timing out
Waits until a given condition is ready for a given number of seconds. Errors on given timeout out seconds.
Waits until a given condition is ready for a given number of seconds. Errors on given timeout out seconds.
- Value parameters:
- condition
the boolean condition to wait for (until true)
- reason
a description of what is being waited on
- timeoutSecs
the number of seconds to wait before timing out
- Definition Classes
- EvalContext
Waits until a given condition is ready for a given number of seconds using a given polling delay. Errors on given timeout out seconds.
Waits until a given condition is ready for a given number of seconds using a given polling delay. Errors on given timeout out seconds.
- Value parameters:
- condition
the boolean condition to wait for (until true)
- delayMsecs
the polling delay (milliseconds)
- reason
a description of what is being waited on
- timeoutSecs
the number of seconds to wait before timing out
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.
- Value parameters:
- function
the function to perform
- takeScreenShot
true to take screenshot after performing the function
Inherited methods
Gets a named data scope (creates it if it does not exist)
Gets a named data scope (creates it if it does not exist)
- Value parameters:
- name
the name of the data scope to get (or create and get)
- Inherited from:
- Environment
Adds a step definition to the context.
Adds a step definition to the context.
- Value parameters:
- name
the name
- stepDef
the step definition to add
- Inherited from:
- Environment
Adds a step definition to the context.
Adds a step definition to the context.
- Value parameters:
- stepDef
the step definition to add
- Inherited from:
- Environment
- Inherited from:
- EvalContext
Create a clone of the current environment state
Create a clone of the current environment state
- Inherited from:
- Environment
- Inherited from:
- EvalContext
Decodes a base 64 encoded string.
Decodes a base 64 encoded string.
- Value parameters:
- source
the encoded source string
- Returns:
the decoded result string
- Inherited from:
- DecodingSupport
Compares two strings for similarity and returns a percentage score.
Compares two strings for similarity and returns a percentage score.
- Value parameters:
- value1
string 1
- value2
string 2
- Returns:
the DSC similarity score (if it could be calculated), otherwise None
- Inherited from:
- SimilaritySupport
Evaluates an function or returns the given dry value depending on--dry-run mode.
Evaluates an function or returns the given dry value depending on--dry-run mode.
- Value parameters:
- dryValue
the dry value
- function
the function to evaluate
- Inherited from:
- EvalContext
Evaluates an json path expression against a JSON source string and returns the result.
Evaluates an json path expression against a JSON source string and returns the result.
- Value parameters:
- jsonpath
the json path expression
- source
the json source string
- Returns:
the result of evaluating the json path expression
- Inherited from:
- JsonPathSupport
Evaluates an xpath expression against an xml source string and returns the result.
Evaluates an xpath expression against an xml source string and returns the result.
- Value parameters:
- source
the xml source string
- targetType
the target node type
- xpath
the expath expression
- Returns:
the result of evaluating the xpath expression
- Throws:
- gwen.Errors.XPathException
if the xpath expression fails to evaluate
- Inherited from:
- XPathSupport
Evaluates an SQL query against a database and returns the first column value of the first row in the result.
Evaluates an SQL query against a database and returns the first column value of the first row in the result.
- Value parameters:
- database
the database name
- sql
the SQL statement to execute
- Returns:
the first column value of the first row in the result
- Inherited from:
- SQLSupport
Executes an SQL update statement against a database and returns the number of rows affected.
Executes an SQL update statement against a database and returns the number of rows affected.
- Value parameters:
- database
the database name
- sql
the SQL update statement to execute
- Returns:
the number of rows affected (as a string)
- Inherited from:
- SQLSupport
Extracts a substring from a source string by regex. The value in the first matching regex group is returned, otherwise an error is thrown.
Extracts a substring from a source string by regex. The value in the first matching regex group is returned, otherwise an error is thrown.
- Value parameters:
- regex
the regex extractor pattern
- source
the source string
- Returns:
the extracted value
- Throws:
- gwen.Errors.RegexException
if the regex fails to evaluate
- Inherited from:
- RegexSupport
Filters all attributes in all scopes based on the given predicate.
Filters all attributes in all scopes based on the given predicate.
- Value parameters:
- pred
the predicate filter to apply; a (name, value) => boolean function
- Returns:
a new Scoped data stack containing only the attributes accepted by the predicate;
- Inherited from:
- Environment
Gets a named binding
Gets a named binding
- Value parameters:
- name
the binding name
- Returns:
a binding
- Inherited from:
- EvalContext
Gets the paraterised step definition for the given expression.
Gets the paraterised step definition for the given expression.
- Value parameters:
- docString
optional step docString (parameter)
- expression
the step expression to get the step definition for
- Returns:
the step definition and its parameters (name value tuples) if a match is found; None otherwise
- Inherited from:
- Environment
Interpolate all references in the given step.
Interpolate all references in the given step.
- Value parameters:
- step
the step to interpolate
- Returns:
the interpolated step
- Inherited from:
- EvalContext
Interpolate all parameters in the given step before it is evaluated.
Interpolate all parameters in the given step before it is evaluated.
- Value parameters:
- step
the step to interpolate
- Returns:
the interpolated step
- Inherited from:
- EvalContext
Checks if a top level step is currently being evaluated).
Checks if a top level step is currently being evaluated).
- Inherited from:
- Environment
Matches a template against a given source and extracts, ignores, or injects values.
Matches a template against a given source and extracts, ignores, or injects values.
- Value parameters:
- source
the source string
- sourceName
the name of the source attribute
- template
the template string
- Returns:
success if there is a match; an error otherwise
- Inherited from:
- TemplateSupport
Performs an operation only if --dry-run mode is off.
Performs an operation only if --dry-run mode is off.
- Value parameters:
- operation
the operation to execute
- Inherited from:
- EvalContext
Removes (unloads) the stepdef with the given name
Removes (unloads) the stepdef with the given name
- Value parameters:
- name
the step def name
- Returns:
the removed step def
- Inherited from:
- Environment
The spec type currently being evaluated.
The spec type currently being evaluated.
- Inherited from:
- Environment