Unable to perform validations

2 posts, 0 answers
  1. Vishal
    Vishal avatar
    18 posts
    Member since:
    Jan 2014

    Posted 28 Feb 2014 Link to this post


    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.


  2. Boyan Boev
    Boyan Boev avatar
    1072 posts

    Posted 06 Mar 2014 Link to this post

    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.

    Boyan Boev
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top