标题: 【QTP 访问远程文件代码片】 [打印本页] 作者: 假装不在 时间: 2008-10-9 19:19 标题: 【QTP 访问远程文件代码片】 Public Function Log_in(ip,user,pw)
Dim oShell
Set oShell = CreateObject ("WSCript.shell")
oShell.run ip
Set oShell = Nothing
wait (2)
If Dialog("nativeclass:=#32770","index:=0").exist(1) Then
Dialog("nativeclass:=#32770","index:=0").WinEdit("nativeclass:=edit","index:=1").set user
Dialog("nativeclass:=#32770","index:=0").WinEdit("nativeclass:=edit","index:=2").set pw
Dialog("nativeclass:=#32770","index:=0").WinButton("nativeclass:=Button","index:=0").click
End If
End Function
其次,把这段代码放到QTP中运行,还是给我一个报错信息:
General Run Error的消息框。(在运行oshell.run ip的时候)
Log_in "150.245.167.75","user","123456"
Public Function Log_in(ip,user,pw)
Dim oShell
Set oShell =CreateObject ("WSCript.shell")
oShell.run ip
Set oShell = Nothing
wait (2)
If Dialog("nativeclass:=#32770","index:=0").exist(5) Then
Dialog("nativeclass:=#32770","index:=0").WinEdit("nativeclass:=edit","index:=1").set user
Dialog("nativeclass:=#32770","index:=0").WinEdit("nativeclass:=edit","index:=2").set pw
Dialog("nativeclass:=#32770","index:=0").WinButton("nativeclass:=Button","index:=0").click
End If
End Function作者: 假装不在 时间: 2008-10-13 22:24
因为你调用错了,写少了“\\”作者: heqingbluesky 时间: 2008-10-14 10:29
看来我犯了常识性的错误 ,qtp的报错我有点看不懂了。