问题
I am new to QTP and I have a problem with "error validation message". I have a task that checks whether the error validation message appears when invalid input is entered. I tried to check before and after the data is entered, but unfortunately the QTP recognies the "error message" and see is even that the error is not displayed on the page.
can I handle this issue ?
回答1:
The error message may exist even if you can't see it, especially in web applications an element is often there but invisible until it's needed.
You can check if the error message object is visible, there are three common ways in which an object can be invisible
- It has a property marking it as invisible (e.g. in Web
visible=false
) - It has a zero width or height
- It is located off-screen (often in a negative position)
- Note that for multiple monitors a negative position may still be visible.
Find out how to distinguish a visible error message from an invisible one and write your test accordingly.
来源:https://stackoverflow.com/questions/9789995/how-do-i-handle-object-existence-with-qtp