An error occurred while identifying objects in qtp descriptive Programming

Source: Internet
Author: User
Yesterday, I encountered a strange phenomenon of qtp descriptive programming. The previous script suddenly failed to be verified. After several attempts, I finally found the rule, that is, there is an error in object identification in descriptive programming of qtp. If you have encountered this problem or have a good solution, please advise.

The crime scene is as follows:
Define the object with descriptive programming in the script
Verify whether the object exists and click this object to delete it. All operations here are normal.
Verify the deletion result and determine whether the object exists. The object still exists! (An error occurs here)
However, if you delete the object and verify whether the object exists, if you set another object, the object does not exist (correct)

The script is as follows:
Set OBJ = browser ("XX"). Page ("XX"). webelement ("innertext: = xx", "HTML Tag: = span ")
Msgbox obj. exist (2) -- true
OBJ. Click
OBJ. fireevent "oncontextmenu" -- Right-click the menu
Browser ("XX"). Page ("XX"). webelement ("Delete (d)"). Click -- delete
Msgbox obj. exist (2) -- true (error)
Set OBJ = browser ("XX "). page ("XX "). webelement ("innertext: = xx", "HTML Tag: = span") -- if you set it again, you can determine whether it is correct.
Msgbox obj. exist (2) -- false

If the preceding settings are not set again, the following methods can also get the correct results, indicating that the object recognition has an error.
Msgbox browser ("freequery "). page ("freequery "). webelement ("innertext: = qqq", "HTML Tag: = span", "index: = 0 "). exist (2) -- false

In addition, an object is set on a page. If you exit this page, you need to redefine the object even if it does not change. Otherwise, the object cannot be found.

I hope you can give me some advice on how to avoid this problem.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.