Advanced class mapping

After the simple case in the previous section we will take a look at a more complex scenario now. Let's analyze how the text fields displaying the selected price information are treated, e.g. the final price text field. Like in the previous section we need to record some mouse clicks or text checks on those text fields. Then we need to navigate to the recorded components and analyze them. The figure below shows the current situation and our goal.

Current recordingSimplified recording
Current recordingSimplified recording
Figure 49.12:  Simplification due to advanced class mapping

We got some SPAN nodes recorded. Here we have no class attribute, but an id attribute in the HTML. So, we can conclude that the id is very specific to the particular field. When you select its parent component, which is a TD node, you will find a class attribute with the value textfield, which corresponds to the actual component class. When you select that component, QF-Test also highlights the entire text field on the web page. So we can assume that a component with the value textfield for the class attribute represents a text field semantically.

Figure 49.13:  Recording of SPAN text fields

So, now let's extend the configuration of our 'Install CustomWebResolver' node. We need to map the textfield value as generic class TextField. Therefore, we extend the category genericClasses by TextField: textfield.

When you delete the previously recorded component, rerun the 'Install CustomWebResolver' node, reload the web page and re-record the component, you will get the following recording:

Figure 49.14:  Recording text fields in "CarConfigurator Web"

The text fields will be recorded as expected, and we even get rid of one level in the component hierarchy. In addition, the text fields have QF-Test specific attributes like the extra feature qfs:label assigned.

The next section show a translation for components which contain data and how to access that data afterward. Such components represent data tables, trees or lists and are handled as complex components by QF-Test.