请帮我看下短代码获取随机数有什么错误,谢谢!
Browser("Wholesale – Buy China").Page("Wholesale – Buy China").Link("Clothing").ClickItemCount =Browser("Wholesale – Buy China").Page("China Wholesale Clothing").WebList("sort").GetItemsCount
SelectItem=RandomNumber(0,ItemCount )
Browser("Wholesale – Buy China").Page("China Wholesale Clothing").WebList("sort").SelectSelectItem ItemCount =Browser("Wholesale – Buy China").Page("China Wholesale Clothing").WebList("sort").GetItemsCount
.GetItemsCount存在吗?我咋没见过呢
改用下面这个,应该没问题了
ItemCount =Browser("Wholesale – Buy China").Page("China Wholesale Clothing").WebList("sort").GetROProperty("items count")
[ 本帖最后由 wolaizhinidexin 于 2010-4-22 11:36 编辑 ] 不知道你是报什么错,根据你这段脚本,猜测可能是下面这个地方出错了,
SelectItem=RandomNumber(0,ItemCount )改成SelectItem=RandomNumber(0,ItemCount -1)试试,因为你如果是从0开始的,最多只能取到ItemCount -1,要么就是从1到ItemCount
提示错误
ItemCount =Browser("Wholesale – Buy China").Page("China Wholesale Clothing").WebList("sort").GetItemsCountSelectItem=RandomNumber(0,ItemCount )
Browser("Wholesale – Buy China").Page("China Wholesale Clothing").WebList("sort").SelectSelectItem
提示错误为不支持此属性
对象不支持此属性或方法: 'Browser(...).Page(...).WebList(...).GetItemCount'Line (2): "ItemCount=Browser("Wholesale – Buy China").Page("China Wholesale Clothing").WebList("sort").GetItemCount".
谢谢了啊,最近比较忙都没怎么上来看过
GetROProperty也不行啊
改为它ItemCount =Browser("Wholesale – Buy China").Page("China Wholesale Clothing").WebList("sort").GetROProperty("items count")过是过去了但获取不到随机值总是录制的时候的那个值 原帖由 backhome 于 2010-4-27 14:16 发表 http://bbs.51testing.com/images/common/back.gif
改为它ItemCount =Browser("Wholesale – Buy China").Page("China Wholesale Clothing").WebList("sort").GetROProperty("items count")
过是过去了但获取不到随机值总是录制的时候的那个值
用VBS的Rnd函数来取随机数吧,使用格式:
Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
参考代码:
Randomize ' Initialize random-number generator.
MyValue = Int((6 * Rnd) + 1) ' Generate random value between 1 and 6.
页:
[1]