I need help about if...then statement in keyword testing. I'va an form where an column contains two LOVs i.e., Yes & No. When user select Yes more additional fields are appearing and if user select N...
If a user selects "Yes," an additional two to three dependent fields appear below it. If "No" is selected, the form proceeds normally without displaying these additional fields.
I think an 'If Object' after TC clicks Yes would work. The' If Then' block may not be what you want?
Get back to us with the behavior you are trying to test if you are still stuck. Pass me a like 👍🏼or set this as resolved if I gave you the info to answer your question.
I am currently conducting system testing for a web-based application. During this process, I’ve encountered a dynamic form scenario where the visibility of certain fields depends on user input in another fields.
Specifically, there is a field called "UOB" with a drop-down list containing "Yes" and "No." If a user selects "Yes," an additional two to three dependent fields appear below it. If "No" is selected, the form proceeds normally without displaying these additional fields.
I am using TestComplete for keyword testing and am unsure how to properly handle this conditional field behavior. Could you advise on the best approach or relevant TestComplete keywords to manage such dynamic UI changes.
For this scenario, don’t branch on the dropdown value itself—branch on what appears in the UI after the selection.
Recommended approach:
Select Yes or No from the UOB dropdown
Wait for the page to update (WaitProperty or short Delay)
Use If Object or If…Then with a Property Checkpoint
Example logic:
After selecting Yes → If Object (DependentField.Exists = True) → Fill the additional fields
After selecting No → Verify the dependent fields do not exist and continue
Important note: When checking that an object exist, TestComplete will wait up to its default timeout (typically 10 seconds) before continuing. To avoid unnecessary delays, it’s a good practice to lower the check operation timeout to 1 second.
Best keywords to use:
If Object
Property Checkpoint (Exists or Visible)
WaitProperty
This is the most reliable way to handle dynamic fields in TestComplete keyword tests.
🤖 AI-assisted response 👍 Found it helpful? Click Like ✅ Issue resolved? Click Mark as Solution
You'll get the sample website appearing on the right hand side,
Keyword Test - the conditional if-statement reads like so: If Aliases.selectIsUob.wText == "No" Then Log Aliases.textboxBankBranch.Text Else Log Aliases.textboxUobBranch.Text
It will either display "NatWest" if UOB equals "No", or it will display "UOB Singapore Main Branch" if UOB is not equal to "No".
Remove "selected" from line 17 and insert it on line 18, and click 'Run >'. Run the keyword test again.