Dealing with a dynamic class name.
When an object is not being found at test execution time the log that is created when executing web tests (_Certify_Html_Version3_Log.txt) is invaluable. Please see this article on how to retrieve the _Certify_Html_Version3_Log.txt file.
This log file is overwritten with each test run so it must be looked at after the test fails but before another test is run.
If the log files shows that the classname of the object is dynamic, the attribute string will need to be revised to only look for the static values with a startswith or a contains criteria.
Changing the classname will resolve the item not found problem.
Option 1: Removing attribute from the attribute string.
on a webpage where there is a Rich Combo Box whose class name appears to be dynamic (as determined by the _Certify_Html_Version3_Log.txt file):
1. Learn the entire page using Web Learn, and import the map.
2. Changed the attribute for that particular object (Rich Combo Box) by removing Classname, Name and ID. Only Type remains in the object attribute.
3. Build a step to input the value in to the Rich box in the following methods
Set property:
Added the step with the 'set property' action with the Parameters for set property as
Property: Value
Value: Value as present in the combo box/dropdown. (You can use the same method to input any value that is not in the dropdown )
Input :
You can use the 'Input' action to input the values.
3 Run the process
4. The value can be input into the Rich Combo box.
Comment: Since you left only the "Type" attribute for recognition, the instance may have been increased since you took away almost all of the unique identifiers. It is always best to leave as much there as possible by modifying the attributes to still use the static part of the attribute value and changing the criteria, please see option 2 and option 3 below.
Option 2: Use the condition "Starts with" in the attribute string.
For instance, if the ID is MyID99 and the "99" is dynamic, you can change the attributes to be ID startswith MyID.
Option 3: You can also add other attributes to use for recognition. If you right-click in the findby grid there are options to Edit, Add, and Remove.
Also whenever you do use the tools in the learn to modify the attribute strings the learn will then verify that the <instance> in the attribute string is still correct and adjust it if necessary.
Note: The CertifyPath is never used unless there are no values for other attributes configured for recognition for the element in question.
Option 4: There is also a way to create a "dynamic list item" object that can be used to actually click the desired list item after a step to click the button part of the complex control.
Option 5: You can also input the correct value into the textbox part of the complex control as shown in the second screenshot below.
