ÈçºÎ»ñÈ¡ÏÂÀ´²Ëµ¥µÄÖµ£¿
ÓÐÕâô¸ö°´Å¥£¬µã»÷ÏÂÀ°´Å¥£¬»áµ¯³öÏÂÀÖµ£¬Èç¹û»ñÈ¡Õâ¸öµÄhtmlµÄ´úÂëÈçÏÂ: Õâ¸ö²»»á£¬ÖªµÀµÄÈË°ïæ½â´ðÏÂÁË~ ÔÚÍøÉÏ¿´µ½ÓÃgetelementbyid·½·¨
Set Olilist=Browser("ÈËÈËÍø - ÎÒµÄÁôÑÔ°å").Page("ÈËÈËÍø - ÎÒµÄÁôÑÔ°å").Object.getElementById("dropmenuHolder").ChildNodes.ChildNodes
Ìáʾ¶ÔÏó²»Ö§³Ö£¬ChildNodes.ChildNodes·½·¨ Äã¿ÉÒÔÖ±½Ó¿´µã»÷ºóµ¯³öµÄÏÂÀ²Ëµ¥Äܲ»Äܱ»SPYʶ±ðµ½¡£ÄÜʶ±ðµ½µÄ»°¾Í¿ÉÒÔÖ±½Óµ÷Óã¬Èç¹ûÒ³ÃæÖеÄÏàͬµÄÔªËؾͶ༸¸öÆ¥ÅäÖµÀ´Ê¶±ð¡£¿´¿´ÕâÑùÐв»£¿¡£¡£ »Ø¸´ 3# СѾͷamy
ÕâÊÇÈËÈËÍøÉϵģ¿ ¹«Ë¾¿ª²»ÁË£¬ÎÒ»ØÈ¥ÔÙ¿´Ï »Ø¸´ 4# geek
spyʶ±ð²»µ½ »Ø¸´ 5# ºÚÓð¼À
Êǵģ¬ÈËÈËÍøÉϵÄÁôÑÔ°æ 1£¬spyʶ±ð²»ÁË¡£ÊÇ˵ʶ±ð²»³É±ê×¼µÄweb¿Ø¼þ£¬»¹ÊÇ˵Äãspyµã²»ÉÏÈ¥¡£Èç¹ûÊǺóÕߣ¬ÔÚspyµÄʱºò°´×¡ctrl¿ÉÒÔ²Ù×÷Ò³Ã棬ȻºóËÉ¿ªÒ³Ãæspy²é¿´¡£
2£¬ChildNodes.ChildNodes Ã÷ÏÔÊÇ´íµÄ£¨ÎÒûÕâôÊÔ¹ý£©£¬childNodesÊǸö¶ÔÏ󼯺ϣ¬ºó¸úchildNodes·½·¨£¬Ã»ÓÐÒÀ¾Ý¡£
3£¬µ±Ê¹ÓÃa.b.c.d.function(e)·¢Éú´íÎó£¬ÌáÎÊʱӦ·¢³öab c d ¸÷¼¶¶ÔÏóµÄexistÊ**¬ÖÁÉÙÓ¦¸ø³ö×îºóÒ»²ã¶ÔÏóµÄ¸ÃÊ*¸ø³ö×îºóÒ»²ã¶ÔÏóµÄspy¡¾ºÍ¡¿QTP watchÐÅÏ¢£¬×îºÃ¸ø³ö¶ÔÏódocumentElementµÄÐÅÏ¢
½«2¸öchildnodes·Ö¿ªÐ´¾ÍºÃÁË¡£ »Ø¸´ 9# Ì©È»
µ«ÊǹؼüÊÇÕâ¸ödivûÓÐidºÅ
Õâ¸öÔ´´úÂëÈçÏ ±¾²ãÔªËØûÓÐid£¬¿ÉÒÔʹÓÃÍâ²ãÔªËصÄid,±ÈÈç dropmenuHolder£¬ÔÀíÊÇÒ»ÑùµÄ »Ø¸´ 11# xjwldlover
Ã÷°×ÁË£¬Ð»Ð»¡£ µ«ÊÇ£¬ÎªÊ²Ã´ÔËÐеÄʱºò£¬»á±¨Õâ¸ö´íÎóÄØ£¿ÊÇÎÒµçÄÔµÄÅäÖÃÓйØϵÂð£¿
×îÖÕµÄдµÄ´úÂëÈçÏÂ:
Set list=Browser("ÈËÈËÍø - ÎÒµÄÁôÑÔ°å").Page("ÈËÈËÍø - ÎÒµÄÁôÑÔ°å").Object.getElementById("dropmenuHolder").ChildNodes
print list.item(0).Nodename
Set list1=list.item(1).ChildNodes
print list1.item(0).Nodename
For i=0 to list1.length-1
print list1.item(i).innertext
Next
Set list1=nothing
Set list=nothing °²×°²¹¶¡°ü QTP_00604.EXE Ó¦¸Ã¿ÉÒÔ½â¾ö ±¾Ìû×îºóÓÉ wuyunyue ÓÚ 2012-12-25 17:30 ±à¼
ÎҼǵÃÓÐÒ»¸ö·½·¨ÊÇÖ±½Ó»ñÈ¡hrefµÄ.¶ÔÓÚhrefµÄ²»ÍƼöÄãÕâôµÄÖ±½ÓץȡԪËØ.Ö±½Ó»ñÈ¡ÔªËØÁ¬½Ó¸üÖ±½Ó.select¿òÌåÊÇ¿ÉÒÔÖ±½ÓÓÃÖµÀ´Ä£Ä⶯×÷µÄ.ÎÒÒ»»áÕÒÕÒÎÒÒÔǰдµÄ½Å±¾.ת·¢¸øÄã.Ñ°ÕÒurlÀàËÆÕâÖÖ.
String activityId =lancer.get().getAttribute(link_xpath + "/@href")ÏÂÀ¿òÌåµÄ¿ÉÒÔÓÃÀàËÆ:select 'generalRating',strGeneralRating.
¶àÕÒÕÒÄãµÄ·½·¨¡£ »Ø¸´ 14# xjwldlover
ÎÒÕâ¸öÊÇ9.2°æ±¾µÄ »Ø¸´ 14# xjwldlover
ÎÒµÄÊÇqtp 9.2°æ±¾µÄ£¬Õâ¸ö²¹¶¡Ó¦¸ÃÊÇ10.0°æ±¾µÄ°É »Ø¸´ 17# СѾͷamy
¸Ã»»10ÁË£¬±ðÈ˶¼ÓÃÉÏ11.5ÁË¡£ ¿´¿´ÄãÊDz»ÊÇÏëÎÊÕâ¸öÎÊÌ⣺
ÏÖÔÚÎÞ·¨ÆË×½µ½ÏÂÀ¿òµÈ¿Ø¼þ
ÎÒ¼òµ¥µÄдÁËһϣ¬²»¶®µÃ»°£¬¿ÉÒÔÁôÑÔºÃ
http://bbs.51testing.com/thread-883402-1-1.html Èç¹ûQTPʶ±ð³ö¶ÔÏóÊÇWebList£¬ÄǾͿÉÒÔÓÃÒÔϵİ취À´ÊµÏÖ£º
Àý×Ó£º
fromPortCount = Browser("Browser").Page("Find a Flight: Mercury").WebList("fromPort").GetROProperty("items count")
toPortCount = Browser("Browser").Page("Find a Flight: Mercury").WebList("toPort").GetROProperty("items count")
DataTable.AddSheet("FromPort")
Set Sheet = DataTable.GetSheet("FromPort")
For i=1 to fromPortCount
fromPortName = Browser("Browser").Page("Find a Flight: Mercury").WebList("fromPort").GetItem(i)
'Sheet.SetCurrentRow i
Sheet.AddParameter "fromPort",fromPortName
'DataTable.Value(i-1,"FromPort") = fromPortName
Next
DataTable.AddSheet("ToPort")
Set Sheet = DataTable.GetSheet("ToPort")
For i=1 to toPortCount
toPortName = Browser("Browser").Page("Find a Flight: Mercury").WebList("toPort").GetItem(i)
Sheet.AddParameter "toPort",toPortName
'DataTable.Value(i,"ToPort") = toPortName
Next
Ò³:
[1]
2