cancel
Showing results for 
Search instead for 
Did you mean: 

If..Then else statement

SOLVED
Highlighted
Occasional Contributor

If..Then else statement

So i am trying to test one of my usable programs. The steps are i open a new window enter the data and press enter. After that i am changing my parameters and then i press the same button to open a new window i get another design window. I can't understand how to use if then statement on this one. Then i try to add some kind of recognition object it uses or the If...then statement or the Else statement, but it won't do the both. So basically i am stuck either on one or another statement. If i am not explaining it right i can make some pictures.

 

Sincerly,

Dainius

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Hero

Re: If..Then else statement

OK... instead of a strict if..then, there is an operation in keyword tests called "If object".  You should use that... and you'll detect "if this object Exists/Visble/Enabled" perform something... then the "Else" operation can operate from that.  

The way you have it written you have "If the object = true"... but that doesn't work... it's not the OBJECT that you are checking to see if it's true, it's some state of the object... like Exists or Visible...

See https://support.smartbear.com/testcomplete/docs/keyword-testing/reference/test-actions/if-object.htm...


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

View solution in original post

6 REPLIES 6
Highlighted
Community Hero

Re: If..Then else statement

Yeah, I'm not understanding exactly what you're trying to do, either.  Do you have code you can post or screenshots of your keyword test you're building so we can see what logic you're attempting?


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Highlighted
Occasional Contributor

Re: If..Then else statement

Ok. So i have a ReceiptSearch Button which is i the keyword ButtonIekotiKvito.

Then i push it it depends on the settings which one will appear Receipt1(Kvito Paieska_Nr_Z keyword) menu or Receipt2(KvitoPaieskaInvNr keyword) menu.

The object in the If...Then statement is Receipt2 menu.

So what i need is then i change the settings i want to check which one of the Receipt1 or Recipt2 is turned on right now and execute the test. Am i clearer now. Or do you need any addiniotal information ?

Highlighted
Community Hero

Re: If..Then else statement

OK... instead of a strict if..then, there is an operation in keyword tests called "If object".  You should use that... and you'll detect "if this object Exists/Visble/Enabled" perform something... then the "Else" operation can operate from that.  

The way you have it written you have "If the object = true"... but that doesn't work... it's not the OBJECT that you are checking to see if it's true, it's some state of the object... like Exists or Visible...

See https://support.smartbear.com/testcomplete/docs/keyword-testing/reference/test-actions/if-object.htm...


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

View solution in original post

Occasional Contributor

Re: If..Then else statement

Ok so i tried that as well, but what i get is

The 'Aliases.Uvs_WinPos.HwndSource_Cashier3.Cashier' (Receipt1 window) object does not exist.
Highlighted
Community Hero

Re: If..Then else statement

Instead of "Visible" in the If Object, use "Exists"


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Highlighted
Occasional Contributor

Re: If..Then else statement

It works smoothly now. Thank you very much !

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors