This is a migrated thread and some comments may be shown as answers.

Unable to perform validations

1 Answer 41 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Vishal
Top achievements
Rank 1
Vishal asked on 28 Feb 2014, 01:59 PM
Hi,

I have a scenario where an alert box appears. I wanted to validate whether a specific alert message appears or not. I am verifying it as below:

Assert(Find.ByContent<HtmlControl>("locator").getValue(), "actual value");
where Locator is the alert message

Now the problem is , although the alert box doesn't appears at the UI level , but since the alert message is present at html script, my test passes . In actual scenario it should fail because alert box doesn't appear.

I think since ByContent<>()     internally uses Javascript it is able to find the locators. 

Please let me know how to fix this because this will pass all the test instead of failing it.



 

1 Answer, 1 is accepted

Sort by
0
Boyan Boev
Telerik team
answered on 06 Mar 2014, 09:14 AM
Hello Vishal,

Thank you for contacting us.

Since Test Studio directly interacts and verify the DOM tree this is expected behavior. If the element with text locator is present in the DOM this code won't fail.

What changes in the DOM when the box appears? Please monitor the DOM tree and let me know what is the change.

You can try with VeirifyIsVisible step for that message: 

Assert.AreEqual(true, element.IsVisible());


Hope to hear from you soon.

Regards,
Boyan Boev
Telerik
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Vishal
Top achievements
Rank 1
Answers by
Boyan Boev
Telerik team
Share this question
or