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.

  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 https://subject7.atlassian.net/wiki/spaces/SD/pages/40271879 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 https://subject7.atlassian.net/wiki/spaces/SD/pages/40271879

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 ✓ 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 ✓

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 ✓

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.

 

XPath Templates

XPath Templates are used to store XPaths by the user which can be used in the Recorder in Silent Mode. By default, silent mode uses absolute XPaths to traverse to elements, but by using XPath Templates, you can add relative XPaths which will by dynamically used by the algorithm to generate relative XPaths for you. Here’s how it works:

Example:

  1. Relative XPath is captured using Interactive Mode: //a[contains(text(),'LOGIN')]

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

  3. User starts recorder with Silent Mode 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 relative XPath

    2. If the XPath in the template does not work with this element, a step is created with the absolute XPath. For example /html[1]/body[1]/div[1]/div[1]/div[1]/div[3]/div[2]/a[2]

 

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, an absolute XPath will be used.

 

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. While Silent Mode is active, click Capture on the platform

  3. Click Login link on the page

  4. A new step with Click command will be added on the platform. Notice that the XPath is absolute.

  5. Switch to Interactive Mode and record the same link one more time

  6. A new step with Click command will be added on the platform. Notice that the XPath is now relative

  7. Stop the recorder by clicking Stop Recording on the platform

  8. Copy the relative XPath from your step and go to Repository > XPath Templates on the platform

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

  10. Switch back to Silent Mode and Start the recorder. Now capture the element one last time

  11. Your new step will now use a relative XPath which was used from your XPath Template