Version 8.0.1 |
To begin with the example, we resolve the recognition of the '-5%' button in the right bottom corner. The figure below shows our goal. On the left we find the current recording without simplification steps, on the right we see the desired recording.
| |||||||
Figure 50.9: Simplification due to simple class mapping |
First you should record a simple text check or a mouse click to that
button. Then jump to the recorded components via »Locate component«. There you can see that you got a
component of the class DIV
and an empty name.
The other attributes don't provide anything useful.
Please note that QF-Test didn't record the actual text of '-5%' in any
attribute. This means QF-Test has no good information for recognizing that
component. There is just the geometry and the structure information. Now let us
make this component more readable and the component
recognition more robust.
Figure 50.10: Recording of '-5%' button in "CarConfigurator Web" demo |
When analyzing the recorded component more in detail we
discover that there is an extra feature class
with
the value button
. Now we can assume that a button in our project
will have that particular attribute. Especially after verifying the assumption
for further buttons.
So, please insert a 'Install CustomWebResolver' node below the Extras node.
As we found out previously the class
attribute contains the
class information for QF-Test. Knowing this, we can add Button: button
to the category genericClasses
.
The expression Button: button
signifies
that any component with the CSS class button
will be assigned the
generic class Button
.
This will make QF-Test record the default features for
buttons when we re-record the components.
Run the 'Install CustomWebResolver' node and re-record the
component. You will get the following recording:
Figure 50.11: Recording with genericClasses in "CarConfigurator Web" |
As you can see you got a click on component
button-5_
. When you jump to the recorded component
you can see the class Button
has been assigned the '-5%' for the feature as well
and we even got the extra feature
qfs:label
with that text. This
component will now be treated as button by QF-Test. Of course, you should
advise the development team to assign a dedicated ID to that
button as well.
This simple assignment of one value can be sufficient for lots of cases, especially
for buttons, menu items or checkboxes. If your web page doesn't contain that information
in the attribute class
, but in the attribute role
, then you need
to add Button: role=button
to the category genericClasses
.
In some cases the information about the specific class will not be part of the leaf component, but
in a parent component. The next section shows how to deal with this challenge.
Last update: 9/10/2024 Copyright © 1999-2024 Quality First Software GmbH |
1. Functional cookies
We use functional cookies to ensure the basic functionality of the website.
2. Performance and statistic cookies
We use Matomo for analyzing and optimizing our website. Cookies permit an anonymous collection of information that help us offering you a clear and user-friendly visit of our web pages.
This cookie contains a unique, pseudonymized visitor ID internal to Matomo for recognizing returning visitors.
This cookie is used to track from which website the anonymized user proceeded to our website.
The Matomo session cookie is used to track the visitor's page requests during the session.
is created and should be then directly deleted (used to check whether the visitor’s browser supports cookies).
short lived cookies used to temporarily store data for the visit.
short lived cookies used to temporarily store data for the visit.