Ask a Question

Use of If else statement for a object clicked

SOLVED
TC_UserP
Contributor

Use of If else statement for a object clicked

Hello,

  I had a main reusable keyword script , which opened a wizard and then there was a dropdown for me to select options, but now the dropdown is no more and it is a "tree" to select options.

In my script I had used if  else statement where, it had conditions to navigate to certain pages based on what you select in the dropdown . But now because it is a tree I just have to click on the object and then work , my question is what kind of condition can i give for a click in if else statement.

 

I have attached the before and after changes. Please help me with your suggestions.

Let me know if something is not very clear.

1 ACCEPTED SOLUTION

Accepted Solutions
Wamboo
Community Hero

Re: Use of If else statement for a object clicked

Hi,

 

Can you read each dropdown elements as "MenuItem"?

 

If you can do that read whole values into array (if you are using for example javascript) and then create if or maybe switch based on array index.

 

https://support.smartbear.com/testcomplete/docs/reference/test-objects/controls/desktop/general/menu...

item/index.html

 

You can enable a Text Recognition Options option too, and with that option search for value in dropdown.

here is the link for documentation:


https://support.smartbear.com/testcomplete/docs/working-with/managing-projects/properties/open-apps/...

 

Or more simpler solution. Click on dropdown value -> and after that check the wText or maybe Text property of that specific dropdown

 

Let me know if that helped you.

 

View solution in original post

4 REPLIES 4
TC_UserP
Contributor

Re: Use of If else statement for a object clicked

To be more clear, I had made a parameter "import type" for the downdown combo. And given a if condition. But now i just have to click on the tree and have no condition. What can i do in this case.

Wamboo
Community Hero

Re: Use of If else statement for a object clicked

Hi,

 

Can you read each dropdown elements as "MenuItem"?

 

If you can do that read whole values into array (if you are using for example javascript) and then create if or maybe switch based on array index.

 

https://support.smartbear.com/testcomplete/docs/reference/test-objects/controls/desktop/general/menu...

item/index.html

 

You can enable a Text Recognition Options option too, and with that option search for value in dropdown.

here is the link for documentation:


https://support.smartbear.com/testcomplete/docs/working-with/managing-projects/properties/open-apps/...

 

Or more simpler solution. Click on dropdown value -> and after that check the wText or maybe Text property of that specific dropdown

 

Let me know if that helped you.

 

View solution in original post

TC_UserP
Contributor

Re: Use of If else statement for a object clicked

Hello, 

     Dropdown was the old version and I had the solution, but now it is like a tree and my question is can i use if statement for for it. For example if i click on first object of the tree then go to this page and so on.

What i understand is if statement needs condition and my only condition is to cllick the desired object on tree..

 

Marsha_R
Community Hero

Re: Use of If else statement for a object clicked

Like you've said, an if statement requires a condition.  @Wamboo is giving you options for possible conditions that might work.

 

On the other hand, just because your test worked before doesn't mean it's the best way to test now.  How would you test this tree if you had never had the drop down?


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
cancel
Showing results for 
Search instead for 
Did you mean: