A little experience when writing a picture space QTP script

Source: Internet
Author: User

I record QTP script idea is lets can run up to run up, can not run up temporarily regardless of, at the same time take the thought of curing script writing script (detailed), complete and then add parameterization, so that the script flexible! Oh!

The following is a little experience when I write picture Space!

Experience 1: Use the FireEvent method to process a submenu popped out of the top menu

Browser(”淘宝网-店铺管理平台“).Page(”淘宝网-店铺管理平台“).Link(”素材管理(1)”).Click

Browser(”淘宝网-店铺管理平台“).Page(”淘宝网-店铺管理平台“).Link(”图片空间“).Click

When I clicked the top menu with the mouse, I found that the script was not stable at runtime, sometimes it caught the submenu, and sometimes it was not able to capture the submenu, and then added the FireEvent method:

browser(”淘宝网-店铺管理平台“).Page(”淘宝网-店铺管理平台“).Link(”素材管理(1)”).FireEvent “onmouseup”

Browser(”淘宝网-店铺管理平台“).Page(”淘宝网-店铺管理平台“).Link(”图片空间“).Click

You can then capture the submenu every time you run the script.

Experience 2: Confirm page Access objects through object uniqueness

You need to check the number of pictures under the category, the idea is to display the number of pages and database query data, but at this time can not directly read the number of objects, because this object does not have "uniqueness", it belongs to dynamically generated objects. Change the calibration idea is to first get the page with "uniqueness" Object picture category Desc object (the system in the image classification is unique), and then through the DOM object to get the number of the image of the info object.

set my_obj=browser(”图片空间“).Page(”图片空间“).Link(”宝贝图片“).Object

set my_b_info=my_obj.parentnode.nextSibling

And then get a picture of the classification of the image data:

tx=my_b_info.outertext

‘msgbox “a” + tx + “b”  用来校验是否有空格

text=left(tx,len(tx)-4)

‘text=text+0

‘msgbox IsNumeric(text)

Experience 3: Identify link object availability through Currentsytle

Provides two kinds of ideas:

The first way:

V=strcomp(browser(”图片空间“).Page(”图片空间“).Link(”name:=下移“,”index:=5″).GetROProperty(”class”), “move-down J_TagMoveDown no-move-down”,1)

If v=0 Then

 reporter.ReportEvent micPass,”pass”,”提示成功“

else

 reporter.ReportEvent micFail,”fail”,”提示失败“

End If

The second way:

set my_obj =browser(”图片空间“).Page(”图片空间“).Link(”name:=下移“,”index:=5″).object

x= my_obj.currentstyle.getattribute(”cursor”)

y=”not-allowed”

v=strcomp(x,y,1)

If v=0 Then

 reporter.ReportEvent micPass,”pass”,”提示成功“

else

 reporter.ReportEvent micFail,”fail”,”提示失败“

End If

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.