public class JavaScript extends RunOnFailureKeywordsAdapter
| Modifier and Type | Field and Description |
|---|---|
protected BrowserManagement |
browserManagement
Instantiated BrowserManagement keyword bean
|
protected boolean |
cancelOnNextConfirmation |
protected Logging |
logging
Instantiated Logging keyword bean
|
| Constructor and Description |
|---|
JavaScript() |
| Modifier and Type | Method and Description |
|---|---|
void |
alertShouldBePresent() |
void |
alertShouldBePresent(String text)
Verify an alert is present and dismiss it.
|
void |
chooseCancelOnNextConfirmation()
Cancel will be selected the next time a confirmation dialog appears.
|
void |
chooseOkOnNextConfirmation()
Undo the effect of using keywords `Choose Cancel On Next Confirmation`.
|
protected String |
closeAlert() |
protected String |
closeAlert(boolean confirm) |
String |
confirmAction()
Dismisses currently shown confirmation dialog and returns its message.
|
Object |
executeAsyncJavascript(String... code)
Execute the given JavaScript code asynchronously.
|
Object |
executeJavascript(String... code)
Execute the given JavaScript code.
|
String |
getAlertMessage()
Returns the text of current JavaScript alert.
|
protected String |
getJavascriptToExecute(String code) |
protected static String |
readFile(String path) |
runOnFailureByAspectJprotected BrowserManagement browserManagement
protected Logging logging
protected boolean cancelOnNextConfirmation
public void alertShouldBePresent()
public void alertShouldBePresent(String text)
text - Default=NONE. The alert message to verify.public void chooseCancelOnNextConfirmation()
public void chooseOkOnNextConfirmation()
public String confirmAction()
| Click Button | Send | # Shows a confirmation dialog | |
| ${message}= | Confirm Action | # Chooses Ok | |
| Should Be Equal | ${message} | Are your sure? | # Check dialog message |
| Choose Cancel On Next Confirmation | # Choose cancel on next `Confirm Action` | ||
| Click Button | Send | # Shows a confirmation dialog | |
| Confirm Action | # Chooses Cancel |
public Object executeJavascript(String... code)
| Execute JavaScript | return window.my_js_function('arg1', 'arg2'); | # Directly execute the JavaScript |
| Execute JavaScript | ${CURDIR}/js_to_execute.js | # Load the JavaScript to execute from file |
code - The JavaScript code or a file name.public Object executeAsyncJavascript(String... code)
| Execute Async JavaScript | return window.my_js_function('arg1', 'arg2'); | # Directly execute the JavaScript |
| Execute Async JavaScript | ${CURDIR}/js_to_execute.js | # Load the JavaScript to execute from file |
code - The JavaScript code or a file name.public String getAlertMessage()
protected String closeAlert()
protected String closeAlert(boolean confirm)
protected static String readFile(String path) throws IOException
IOExceptionCopyright © 2014. All rights reserved.