Subject7 Recorder (BETA)

Subject7 recorder allows you to record the steps of your test case automatically based on the action you perform on the test automation browser. Recorder currently works on Chrome and Microsoft Edge.

The recorder supports the following commands:

  1. Click

  2. Double_Click

  3. Right_Click

  4. Fill

  5. Clear

  6. Select

  7. Hover

  8. Alert

  9. Switch_Window

  10. Close_Popup

  11. Check

  12. Drag_and_Drop

  13. Verify_Element

  14. Verify_Text

  15. Get_Web_Value

 

The recorder has two recording modes:

  1. Interactive Mode: in this mode, you will be prompted to enter a hint/label that can be used to generate XPaths for your test case. However, you can click Confirm and the recorder will still generate an XPath and capture your step without the hint.

  2. Silent Mode: in this mode, you will not be required to enter a hint/label, everything will be captured automatically. This mode generates relative XPaths by default and can utilize XPath Templates to generate specific XPath formats. Additionally, it can utilize a smart algorithm (same as in Interactive Mode) to generate relative XPaths. Absolute XPaths are only generated as a last resort.

 

Note: Refer to Set Preferences to a Test Case (User Preferences) to activate/deactivate the recorder and switch between modes.

 

The recorder uses inline XPaths in both modes which can be used to interact with web elements. Inline XPaths can also be used without the recorder, please refer to Inline XPaths page for more information.

 

The following video will guide you through the process of using Subject7 recorder

*NOTE: If you are having difficulty viewing video in full screen, please right click video, click Copy video URL and open it on a new browser tab.

Starting Steps

1- Create an automated test case and click Run Test. You do not need to select Goto_URL to start recording, this step can be captured automatically.

image-20240227-111338.png

2- Once the automation browser has started, it will automatically navigate to Subject7’s website. Click Record icon on the platform.

image-20240227-111500.png

3- Paste your URL on the automation browser to capture the navigation step.

4- Once navigation is successful, you will notice that Goto_URL interaction was automatically captured on the platform:

5- You will also notice the recording progress block displayed on the bottom right corner of your screen. This block will change color and will display every recording you make.

6- You can switch between recording modes at anytime during recording. To learn how to do this, please visit Set Preferences to a Test Case (User Preferences)

7- You can determine where a new step is added as follows:

a. By selecting a specific step by clicking on the step checkbox
b. By running your test case up to a specific point, the new step will be added after the step highlighted in green
c. If several steps are selected, the new step will be added after the last selected step

 

Clicking Elements

1- To record clicking elements, simply click any element to record the interaction.

 

2- A box will appear where you will need to enter a hint/label for the object. Once the hint/label is entered in “Target Label” field, you can click Confirm to record your step. If you would like to skip this click interaction, you can click Skip button in the middle. You can also move this box using the button on the left side that allows to drag and drop it.

3- After clicking Confirm and going back to the platform, you will notice that your Click interaction was recorded and an Inline relative XPath was added.

4- If you like, you can convert this Inline XPath into a web locator by clicking the right arrow next to the XPath field. This will allow you to use this web locator in other test cases. The New Locator window will appear where you need to select a Web Page, a Type and an Alias to save your web locator.

5- After the web locator is created, it will be automatically used in your step and Inline XPath will be unchecked.

 

Filling Elements

1- To record the next step (filling Email and Password text boxes), click on the text box, skip the initial click interaction and enter the value you would like to use in the text box. Once a value is entered, click somewhere else or use Tab on your keyboard.

2- Enter a label to identify the element and click Confirm

3- Your step will be captured and added on the platform. As you can see, the value was automatically collected for you.

Verifying Text on Screen

1- To verify that the logged in, we can validate that the text “Tom Smith” appears on the page. To do that, select the text as below

2- The recorder will automatically record this verification for you and you will see a step on the platform with Verify_Text command.

NOTE: If the text is located inside a frame, the frame XPath will be automatically added and Inline Frame checkbox will be enabled. If you would like to use this frame in other test cases, you can uncheck Inline Frame and create a web locator to add the XPath of that frame.

 

Getting Values, Hovering and Verifying Elements

1- To record these interactions, simple click the object and record Click Interaction. For example, let’s click on the post highlighted below:

2- On the displayed popup, click on the dropdown list to display all interactions. You can choose HOVER, VERIFY_ELEMENT or GET_WEB_VALUE.

3- Alternatively, you can record clicking interaction and expand the Click step, you will see a dropdown list next to Convert to. You can select Get_Web_Value to retrieve a value from screen, Hover to hover over an element or Verify_Element to verify the existence of an element using XPath. Once you select an action, click Convert.

4- If you choose Get_Web_Value from the recorder popup, a variable name will be automatically added for you, but if you convert from Click, you will need to enter a variable name. You can change the Type according to your scenario and you can also convert the Inline XPath into a web locator if you would like to use the same web locator in other test cases by using the Right Arrow icon.

5- If you choose Hover, you can convert the Inline XPath into a web locator if you would like to use the same web locator in other test cases by using the Right Arrow icon.

6- If you choose Verify_Element, you will see that Exists radio button is enabled. If you would like to verify that this element does not exist, you can enable Does Not Exist radio button instead. Check Invisible will allow you to verify the existence of invisible elements and Check Disabled will allow you to verify disabled elements. With these checkboxes disabled, these steps will fail depending on the state of your element. You can also convert the Inline XPath into a web locator if you would like to use the same web locator in other test cases by clicking the Right Arrow icon.

Double-Clicking and Right-Clicking Elements

1- In order to record double-clicking or right-clicking elements, simply double click/right click on any element and enter the label for the element

2- Your steps will be captured on the platform as shown below.

Double_Click:

 

Right_Click:

 

Clearing Elements

1- In order to clear an element (such as a text box) from any existing data, click on the text box next to the text and keep pressing Backspace on your keyboard until the data is removed.

2- Afterwards, click elsewhere or use Tab on your keyboard. The next form will appear. Enter a label for the element and click Confirm

3- A step with Clear command will be automatically added to the platform:

 

Selecting Options from a Dropdown List

1- In order to select an element from a dropdown list, simply click on the dropdown list and make your selection. A form will appear afterwards.

2- Enter a label for the option you selected and click Confirm

3- Back on the platform, a step with Select command will automatically be added:

 

Frames and Popups

If you are recording actions for elements which are placed in frames or popups, the frames and popups will be automatically captured by the recorder. Frames will be captured using Switch_Frame command and popups will be captured with Switch_Window command using the index field.

 

Checkboxes

1- To interact with checkboxes, simply click on the desired checkbox and a form will appear afterwards.

2- Enter a label that closely matches the element and click Confirm

3- Your step will be added using Check command. The status of “Check” will be determined based on the status of the checkbox on the test automation browser page. If it was unchecked and you checked it, “Check” will be enabled on the step. If it was checked and you unchecked it, “Check” will be not be enabled on the step.

 

Dragging and Dropping

1- When recording drag and drop elements, simply drag the object and drop it in the place where you would like it dropped. A form will appear afterwards.

2- In this form, you will need to enter a label for the element that was dragged and a label for the element where it was dragged into

3- Your step will be added using Drag_And_Drop command as shown below:

 

 

Alerts

1- When working with alerts such as the below, clicking OK or Cancel on the alert will be automatically captured and added to a step based on your selection.

2- The command Alert will be used with OK option if you click OK

3- The command Alert will be used with Cancel option if you click Cancel

 

Switch_Window / Close_Popup

1- When recording a test case that opens a window on a new tab, the switch is automatically captured and added to the test case steps.

2- When you are finished recording all actions on the new page, simply close it and the title will be collected automatically by the recorder and added to the Value field. This value will be used to distinguish which page to close during the next execution of the test case. You can pick an alternative option if you wish to do so (Handler index, Last popup or Close all except main)

XPath Templates

XPath Templates are used to store XPaths by the user which can be used in the Recorder in both modes. You can use XPath Templates to add specific relative XPaths which will by dynamically used by the algorithm to generate XPaths for you. Here’s how it works:

Example:

  1. Relative XPath is prepared: //a[contains(text(),'LOGIN')]

  2. XPath Template is created which contains the XPath. For example: //a[contains(text(),'$LABEL')]

  3. User starts recorder and clicks on an element to capture it:

    1. If the XPath in the template works with this element, a step is created with the exact XPath under XPath Templates ($LABEL will be replaced with the text visible on the element)

    2. If the XPath in the template does not work with this element, Recorder will try to generate a relative XPath. If none of the options work, an absolute XPath will be generated as a last resort.

NOTE: XPaths can be separated by creating several XPath Templates and adding different descriptions for them, but generally the Recorder will use all available XPaths from all templates to match your case and if no match is found, the other mechanisms will take place.

 

The following scenario will show you how you can practice XPath Templates:

 

  1. Start a new test case and navigate to the website https://reference.subject-7.com

  2. Generate an XPath for Login link. You can use Recorder to generate one then make small changes, or you can generate one manually. For example: //a[text()='LOGIN']

  1. Add the XPath to XPath Templates by going to Repository > XPath Templates on the platform

  2. Create a new XPath Template and replace LOGIN with $LABEL. Save the XPath Template and close it

  3. Click Record on the platform to start recording this element using the XPath Template

  4. Your new step will now show the XPath which was used from your XPath Template

Advanced Functions

Same as in Gutenberg, Recorder has some advanced functions that appear when you click Advanced button on each prompt in Interactive Mode.

1- Distance: When using hints of other elements as an anchor point to traverse to your element, the distance between the anchor and your element may vary and you have the option to determine the distance (Very Close, Close, Middle, Far, Very Far). For example, the below image shows a text "podcast" which is very far from the target element (hyperlink). If you have several elements with the same text where you would like to use one as an anchor point, you can determine the distance which controls the closest or the farthest element to be used.

(//script[contains(text(),'podcast')]/ancestor::body/header/div/nav/div/div/div/div/nav/div/div/a)[1]

2- Match Case: this option allows Gutenberg to match the case of your hint with the text on screen. If the text you entered is not the same, the XPath will not be generated until your hint is a match. This option is disabled when the Hint box is empty.

3- Full Match: this option allows Gutenberg to provide an XPath using an exact match of the hint text.

For example, an XPath without full match: //a[contains(text(),'LOGIN')]

while an XPath with full match: //a[text()='LOGIN']

4- Use ID Attribute: this option allows Gutenberg to generate XPaths using Web IDs if they are available. If not available, it would generate a standard XPath. Note that if your Web IDs are dynamic (meaning they change when you refresh), it's best to avoid using them as your tests will fail when these Web IDs are not found.