Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Command

Target

Value

getDictionary

63F6E******************

{API URL}/DougApicaKey

Info

The API token is masked for privileged users.

Step

Screenshot

This screenshot provides an example of the API GET command for the dictionary “DougApicaKey”.

This screenshot provides another example of the API GET command for the dictionary “ApicaKey”. Note how each dictionary has different defined key-value pairs.

Selenium Example 1: The Dictionary Key "DougApicaKey" has 3 key values (excluding the sample value) that are used in the scenario.

Selenium Example 2: The Dictionary Key "Apicakey" has 2 key values (excluding the sampleKey value) that are used in this scenario.

In this case, the username and password values, from the dictionary will be used in the Selenium scenario. These values will not be hard-coded into the script.

Encrypting Selenium Variables with the “encryptapica” String

Note

This feature must be enabled per customer account. If you are interested in encrypting Selenium variables within your Scenarios, please contact your Technical Account Manager or Support.

...

Info

It is possible to specify any string in the “Value” field for variable encryption as long as it starts with the string “encryptapica”. This string invokes the crypto service which is responsible for encrypting the provided value.

Step

Screenshot

Step 1: Edit a Check which contains a Scenario and click the Debug Scenario icon.

Step 2: Identify the sensitive information to be encrypted.

Step 3: Store the value as an encrypted value by adding a new variable which will hold the encrypted value.

  1. At the top of the scenario, add a new step with the “Store” Command in the dropdown box.

  2. Add a string which begins with “encryptapica” to the “Value” field. In the example, the value is “encryptapicapassword”.

  3. When the “encryptapica” value is added, a warning icon will appear to the right of the step. Once a target is added, the triangle icon will be replaced by a green lock icon.

Step 4: Enter the original Target value.

  1. Double-click in the Target field.

  2. A new dialog box entitled “Update Encrypted Value” will appear. Enter the value to encrypt.

  3. Click the Update & Encrypt to begin the encryption.

Note

Make sure a backup of the value exists elsewhere; Apica does not have the ability to retrieve this value!

Step 5: After the encryption has been completed, the green lock will appear, and the words “[ENCRYPTED BY APICA]” will be present in the Target field.

Step 6: In the step where the password originally appeared, replace the plaintext password with the stored variable name specified earlier. In this case, in step 25, the variable ‘encryptapicapassword’ will be entered as $(variable_name) or $(encryptapicapassword).

Step 7: Test the scenario to ensure it passes the encrypted values to the intended application and click “Save scenario”.

...

Widget Connector
overlayyoutube
_templatecom/atlassian/confluence/extra/widgetconnector/templates/youtube.vm
width1080px
urlhttps://www.youtube.com/watch?v=P-tmcAGpcO8
height300px

Masking Selenium Variables with the “maskapica” Command

Command values can be masked using an Apica-specific prefix when they contain sensitive information. This prevents the value from being displayed in results. Assume a scenario contains the following commands:

...

It is possible to mask the value secretPa$$word in the Check Result page by adding the Store command to store the password as a variable with the prefix maskapica and then using that variable in the actual command which uses the password. The scenario will contain the following commands after the value secretPa$$word is masked:

...

Command

Target

Value

store

*******

maskapicaPassword

open

/

selectWindow

null

type

id=username

user1

type

id=password

\{\{${maskapicaPassword}\}\}

clickAndWait

//input@value='Log in'

Prefixes

Synthetic Monitoring supports custom security prefixes for use in select scenario values where information may need more security.

‘apica’ to store information

Store a result with “apica”

Synthetic Monitoring will store the command result for later display when the "apica" prefix is used in a command value.

Display

The command value is shown in Details in the Details Result Scenario in the Value column.

...

Command

Target

Value

storeCookieByName

ServerID

apicaServerID

This example will store the ServerID cookie value and show it as apicaServerID Extracted Value.

This prefix will work with any command that starts with “store."

Limitations of Selenium IDE within ASM Scenarios

Key Codes

When using sendKeys in Selenium IDE, the key codes ${KEY_ENTER}, ${KEY_SHIFT}, and ${KEY_LEFT} are not valid commands within Selenium IDE. Instead use keyPress with the respective ascii ASCII values for the key you want to be pressed. For example, return/enter is , if you want to press Enter within an application, use the command keyPress and the value \13.

JavaScript Execution

WebDriver’s JavascriptExecutor will wrap all JS and evaluate it as an anonymous expression.

Impact on JavaScript execution

This means that you need to use the “return” keyword:

...

The same is true when evaluation expressions using storeEval or assertEval:

Selenium IDE

assertEval

Code Block
\{\{${stored_var} > 0\}\}

true

WebDriver

assertEval

Code Block
\{\{return ${stored_var} > 0\}\}

true

Note that there are multiple commands that will result in javascript evaluation: gotoIf, assertEval, getEval, and storeEval.

Key Strokes

If you need to simulate a keypress input event, such as pressing the enter key, you must use keyPress or keyPressAndWait (if the keystroke triggers a new page load), with the ASCII as an argument.

Overview

ExampleFor example: Press enter key and wait for new page load

keyPressAndWait

id=gh-ac

\13

...

Agents running Microsoft Windows may handle very short report times incorrectly.

Waterfall graph

Agents running Microsoft Windows sometimes report 0ms for URL calls with very quick response times (0-20ms).

Return Required

For Selenium commmands that execute javascript snippets, the command expects a returned value

Return Command In Scripts

Return Required

ASM Scenario commands which execute JavaScript snippets expect a returned value. The following commands result in javascript evaluation/expects expect a javascript snippet as argument, which must include the 'return' keyword at the start of the expression within the “Target” field:

GotoIf

RunScript

RunScriptAndWait

GetEval

StoreEval

StoreExpression

Type & sendKeys

Even though the "type" command should work works in most cases, we strongly recommend that you use "sendKeys" instead. This is because type Apica strongly recommends using sendKeys instead of type. The type command edits the HTML format of the code, while sendKeys sends it more humanlike which is the sendKeys command attempts to simulate actual typing and is therefore able to trigger javascript code in fields.

...

Incrementing a Stored Numeric Value

It is currently not possible to change the value of a variable from within a javascriptJavaScript snippet.

##

This Selenium IDE code will change the value of $counter:

Command

Target

Value

 storeEval

return (storedVars'counter' + 1)

counter

However the following example won't affect The following command will not change the value of $counter:

Command

Target

Value

 runScript

storedVars'counter' += 1;

counterTwo

...

Info

Knowing how to increment a value is useful when running through a loop in an ASM script!