Hi,
I'm using QA Edition Q3 release. I have a problem with If...ELSE condition. If you see attached video file you will get an idea.
I'm expecting to work atleast ELSE part after I modified navigate URL?
Any ideas please?
Thanks,
Madhu Tekmal
6 Answers, 1 is accepted
the problem is you're trying to Verify the property of an element that isn't there. When you build a Verification in code it looks something like this:
Element.Verify(something)
however when the Element in question can't be found (i.e. it's null) the step automatically fails. After all - you're trying to Verify something about the element - WebUI Test Studio presumes that this means you're 100% certain that the element is there. And since it can't find it it fails the tests - a NullPointerReference situation.
What you want to do is first Verify the element exists. Record a WaitForElementExists step and put it into an IF/Else statement.
Now you can put the other IF/Else statement (the one from your video) inside the Exists IF/Else statement. See screenshot 1.
Now your test will pass against google.com and http://translate.google.bg/#.
Let me know whether this solution covers your needs!
Regards,

Sorry to re-open same If…Else logic issue.
My scenario: Verifying portfolio if exists otherwise create portfolio.(screenshot attached)
I’m taking a string ‘Clear’ and start searching in portfolio search box, if Clear portfolio exists it will display otherwise No data found message will display. Now, I’m verifying
If No Data Found Then
Create a New Clear portfolio
Else
Verify Clear portfolio exists
First time, above logic works fine.
If I, execute again its failing at If condition because its searching for No Data found message but Clear portfolio was created in first run. In this scenario I’m expecting to be run Else part?
I changed If condition Find Logic to NotContain, that time Else part executing fine, but if I take another new search string it is failing.
Please help
me?
Thanks,
Madhu.
change the condition you use in the IF/ELSE statement. Instead of "Verify text contains" change it to "Verify element exits" (recorder this new verification against the same element).
This should work as expected.
Hope to hear from you soon!
Kind regards,

Hi Stoich,
Thanks for support.
I’m trying to record new verification on same element, but I could not find ‘Verify Element Exists” task. (screenshot-1 attached)
If, I took “Wait Element Exists” task then trying to change to Verify statement but it is disabled (screenshot-2 attached).
Thanks,
Madhu.
I admit this is a bit confusing. "Verify elements exists" doesn't exist on its own. Instead you have "Wait for element exists" which you record against an element. When you put this inside a logical statement, it gets converted to "Verify element exists". So step by step here's what you need to do:
1) Record a wait for element exists against the element
2) From the Steps view click on the "+" IF/ELSE (screenshot 1)
3) Go ahead and add the newly-recorded WaitFor step to the IF/Else condition. Don't worry that it already contains another condition - it will get overwritten.
4) You have IF(Verify element exists)
Let me know whether this works for you!

Hi Stoich,
That worked.
Thanks for kind support.
Thanks,
Madhu.