- Install Kantu
- Record a script using Kantu
- Test the script in Kantu
- Troubleshoot script issues using Kantu
- Revise the script as necessary
- Copy the script to APM
Rather than manually entering all script commands, you can use a 3rd-party script recorder, such as UI.Vision Kantu for Chrome, to record your interactions with a web application and automatically generate the Selenium script to mimic your interactions. Kantu creates the script by recording your mouse clicks and key strokes as you interact with a web application - just like recording a macro.
As recording a script is just a starting point, it is likely that, once recorded, you will need to revise it. In particular, you may need to make web element locators more robust and you may need to manually add waits, assertions, or tests. For example, adding a command that waits for something to load, or checks that a certain label exists, or checks that something is visible. Once you are happy with the script, you copy it from the recorder to the appropriate web app group workflow in APM and preview the script execution on a monitoring point.
The following steps describe how to use Kantu (V5.0.1) to record your scripts. The steps are similar with other script recorders.
To install Kantu:
- Open the Chrome browser.
- Go to the UI.Vision Kantu for Chrome page.
- Click Add to Chrome.
- Click Add extension.
- The Kantu is loaded into Chrome.
Record a script using Kantu
Before recording, take some time to plan your steps through the app, and the results you expect to see from it. Start out small. Record a few lines and verify that they play back successfully before moving on.
To record a script using Kantu:
- Open the Chrome browser.
- Navigate to the target URL (the URL of the web app you are creating the script for).
- Click the “UI.Vision Kantu for Chrome” icon on the top right of the Chrome browser.
- Click + Macro.
- Specify the name of the new macro.
- Click Confirm.
- A new macro is created and selected.
- Click Record to start recording.
- Execute the planned workflow at the target URL.
- Confirm that your actions are being recorded in Kantu.
- If an action can’t be recorded, move on and deal with it in the troubleshooting phase.
- Click Stop Record to stop recording.
- Click Save to save the recording.
Test the script in Kantu
Once the script is recorded, play it back to make sure there are no errors.
To play the script in Kantu:
- Click Play Macro.
- You will see the script executing the recorded commands in the Chrome browser.
- The Logs tab shows the commands being executed.
Troubleshoot script issues using Kantu
Use the Logs tab at the bottom of Kantu to review any error messages. Update the script accordingly and play it back again until there are no errors. Use the Resolving Common Issues page for assistance.
Revise the script as necessary
If you need to add commands to pause script execution or to test for things like the visibility or existence of various page elements, this is done by manually entering commands in the script.
To add a command to the script:
- Right-click the command above the one you want to insert and click Insert new line.
- In the Command field, select the command you want to add.
- In the Target field, enter the locator that identifies the target element the command is to act on (if applicable).
- In the Value field, enter a value required by the command (if applicable).
- Click Save.
Continue to revise the script and testing it as necessary to confirm that it behaves as expected.
Copy the script to APM
In order to run the script from your monitoring points, you need to copy it to the workflow of a web app group in APM.
To copy the script to APM:
- In Kantu, in the left panel, right-click the name of the script you recorded and select Export as HTML.
- Click the exported HTML file.
- In your browser you will see a table with the commands on separate rows.
- Right-click the page and select View Page Source.
- The HTML source appears.
- Copy all the HTML source on the page.
- Follow the steps from Create a script but, rather than entering the commands manually, click the Source tab in the Script section of the Edit Workflow page, remove any existing code, then paste the script.
- The script is now loaded in APM.