public class JavaScript extends RunOnFailureKeywordsAdapter
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
acceptOnNextConfirmation |
protected boolean |
acceptOnNextConfirmationDefault |
protected BrowserManagement |
browserManagement
Instantiated BrowserManagement keyword bean
|
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 |
chooseCancelOnConfirmation()
Cancel will as default be selected from now on every time a confirmation
dialog appears.
|
void |
chooseCancelOnNextConfirmation()
Cancel will be selected the next time a confirmation dialog appears.
|
void |
chooseOkOnConfirmation()
Ok will as default be selected from now on every time a confirmation
dialog appears.
|
void |
chooseOkOnNextConfirmation()
Ok will be selected the next time a confirmation dialog appears.
|
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 boolean acceptOnNextConfirmationDefault
protected boolean acceptOnNextConfirmation
protected BrowserManagement browserManagement
protected Logging logging
public void alertShouldBePresent()
public void alertShouldBePresent(String text)
text - Default=NONE. The alert message to verify.public void chooseCancelOnNextConfirmation()
public void chooseOkOnNextConfirmation()
public void chooseCancelOnConfirmation()
public void chooseOkOnConfirmation()
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 static String readFile(String path) throws IOException
IOExceptionCopyright © 2014. All rights reserved.