suxihe 发表于 2013-12-24 09:30:17

请大家帮忙看看这些有什么错误

请大家帮忙看看执行QTP时系统提示如下错误
Dim strText
Dim Cus_Count_String
Dim Cus_Count_Pos
Dim Cus_Count_Len
Dim Cus_Count_Num
Cus_Count_String="Total Customer Count"

Dim Total_Tickets_String
Dim Total_Tickets_Pos
Dim Total_Tickets_Len
Dim Total_Tickets_Num
Total_Tickets_String="Total Tickets Count"

Dim Total_Sales_String
Dim Total_Sales_Pos
Dim Total_Sale_Len
Dim Total_Sale_Num
Total_Sales_String="Total Sales"

window("Flight Reservation").Activate
window("Flight Reservation").WinMenu("Menu").Select"Analysis;Reports..."
If window("记事本").Exist Then
      reporter.ReportEvent micPass,"报告","报告生成并被打开"
      strText=window("记事本").WinEditor("Edit").GetROProperty("text")
      Reporter.ReportEvent micPass,"报告文本","报告文本是:"&strText
               http://www.xmtra.com/zhenrenbaijiale/
      Cus_Count_Pos=cint(instr(1,strText,Cus_Count_String))+len(Cus_Count_String)
      Reporter.ReportEvent micPass,"顾客总数数值的位置","顾客总数数值的位置是:"&Cus_Count_Pos
      Total_Tickets_Pos=cint(instr(1,strText,Total_Tickets_String))+len(Total_Tickets_String)
      reporter.ReportEvent micPass,"订票总数数值的位置","订票总数数值的位置是:"&Total_Tickets_Pos
      Total_Sales_Pos=cint(instr(1,strText,Total_Sales_String))+len(Total_Sales_String)
      reporter.ReportEvent micPass,"订票总数数值的位置","订票总数数值的位置是:"&Total_Sales_Pos

   Cus_Count_Len=cint(Total_Tickets_Pos-Cus_Count_Pos)-len(Total_Tickets_String)
   Total_Tickets_Len=cint(Total_Sales_Pos-Total_Tickets_Pos)-len(Total_Sales_String)
   Total_Sale_Len=Len(StrText)-cint(Total_Sales_Pos)

      Cus_Count_Num=Cint(Trim(Mid(strText,Cint(Cus_Count_Pos),Cus_Count_Len)))
   reporter.ReportEvent micPass,"顾客总数数值","顾客总数数值是:"&Cus_Count_Num
   Total_Tickets_Num=Cint(trim(Mid(strText,Cint(Total_Tickets_Pos),Total_Tickets_Len)))
   reporter.ReportEvent micPass,"订票总数数值","订票总数数值是:"&Total_Tickets_Num
   Total_Sales_Num=Trim(Mid(strText,Cint(Total_Sales_Pos),Total_Sales_Len))
   reporter.ReportEvent micPass,"订票总价钱数值","订票总价钱数值是:"&Total_Sales_Num
      window("记事本").Close
else
   reporter.ReportEvent micFail,"报告","报告未被打开"
End If
在第55行
无效的过程调用或参数: 'Mid'
Line (55): "Cus_Count_Num=Cint(Trim(Mid(strText,Cint(Cus_Count_Pos),Cus_Count_Len)))".
第57行
类型不匹配: 'cint'
Line (57): "Total_Tickets_Num=Cint(trim(Mid(strText,Cint(Total_Tickets_Pos),Total_Tickets_Len)))".
请大家帮忙看看这是什么原因导致的呢?

赵佳乐SMILE 发表于 2013-12-24 15:35:19

其实你仔细看下报告 你就能分析出来 或者你在这句之前 msgbox 一下

txt是Total Ticket Count: 32

Total_Tickets_String="Total Tickets Count" 你这多了个s 会导致 查的地方不对
改成
Cus_Count_String="Total Customer Count:"
Total_Tickets_String="Total Ticket Count:"
要有冒号啊

然后你最后一个值 应该有问题 自己研究一下吧
页: [1]
查看完整版本: 请大家帮忙看看这些有什么错误