6 Selenium Scripting Alerts And WebStorage Reference - essenius/FitNesseFitSharpSelenium GitHub Wiki

These are the available scripting, alerts, and WebStorage functions in the Selenium script fixture:

Alerts

Accept Alert
Description: Accept an alert, confirm or prompt dialog (press OK)
In: -
Out: -
Example(s): | accept alert |
Alert Is Present
Description: Check whether an alert, confirm or prompt box is active
In: -
Out: whether or not an alert is present
Example(s): | reject | alert is present |
Dismiss Alert
Description: Dismiss an alert, confirm or prompt dialog (press Cancel)
In: -
Out: -
Example(s): | dismiss alert |
Respond To Alert
Description: Provide a response to a prompt and confirm (press OK)
In: text to provide to the prompt
Out: -
Example(s): | respond | my response | to alert |

Scripting

Execute [Async] Script
Description: Execute JavaScript (in the browser). If Async is used, execute asynchronously
In: the code to be executed
Out: output of the script
Example(s): | show | execute script | var d=new Date(); return d.getDate(); |
Execute Script With Parameters
Description: Execute JavaScript using parameters. If a parameter has a locator format (with colon), then it is substituted by the element.
In: the script to be executed, array of parameters to pass
Out: output of the script
Example(s): | execute script | arguments[0].innerHTML=arguments[1]; | with parameters | [id:header, New Header Text] |
Execute Script With Plain Parameters
Description: Execute JavaScript using parameters. No substitution of elements is attempted
In: the script to be executed, array of parameters to pass
Out: output of the script
Example(s): | check | execute script | return arguments[0]+arguments[1]; | with plain parameters | [id:header, 1] | id:header1 |
Wait Until Script Returns True
Description: Wait until a called JavaScript function returns a value that is not false or null
In: script
Out: whether the script returns true before the timeout
Example(s): | wait until script | return true; | returns true |

Web Storage

Add To Web Storage
Description: Add a set of key/value pairs to a web store
In: Dictionary of key/value pairs
Out: -
Example(s): | add to web storage | !{city: Rotterdam, country: Netherlands} |
Clear Web Storage
Description: Clear a web store (local or session)
In: -
Out: whether it succeeded (fails if no store capability)
Example(s): | ensure | clear web storage |
Get From Web Storage
Description: Get a value from a web store (local or session)
In: key
Out: value corresponding to the key, or null if not found
Example(s): | check | Get | key1 | from web storage | value1 |
Get Key Like From Web Storage
Description: Find the first key matching a glob pattern (with *?) from a web store (local or session)
In: key
Out: value corresponding to the key, or null if not found
Example(s): | check | Get Key Like | testkey* | from web storage | testkey1 |
Set In Web Storage To
Description: Set a key/value pair in a web store
In: key, value
Out: -
Example(s): | Set | testKey | in web storage to | testValue |
Note(s): Use Use Web Storage to select either Local or Session storage
Remove From Web Storage
Description: Remove an item from web storage (local or session) via its key
In: key
Out: success? (true/false)
Example(s): | ensure | Remove | key1 | from web storage |
Use Web Storage
Description: Select either Local or Session storage (to work on other Web Storage functions)
In: Local or Session
Out: -
Example(s): | Use | Local | web Storage |
Web Storage (Property)
Description: Get or Set a Web Store. Clear any existing values beforehand
In: dictionary of key/value pairs (for set)
Out: dictionary of key/value pairs (for get)
Example(s): | Web Storage | !{name:bob, address:here} |
| $store= | Web Storage |
⚠️ **GitHub.com Fallback** ⚠️