Home > Software engineering >  Questions about the Function, suggesting types do not match
Questions about the Function, suggesting types do not match

Time:10-13


Action1
Browser (" micClass:=Browser "). Navigate "bbs.51Testing.com"
Call NavigatePage (" [QuickTest Professional] ", "BBS")


 Function NavigatePage (linkName, keyWord) 

The Set objBrowser=description. The Create ()
ObjBrowser (" micClass "). Value="https://bbs.csdn.net/topics/Browser"

The Set objPage=description. The Create ()
ObjPage (" micClass "). Value="https://bbs.csdn.net/topics/Page"

The Set objLink=description. The Create ()
ObjLink (" HTML tag "). Value="https://bbs.csdn.net/topics/A"
ObjLink (" text "). The value=https://bbs.csdn.net/topics/linkName

Dim checkTitle
Browser (objBrowser.) Page (objPage). The Link (objLink). Click
CheckTitle=Browser (objBrowser) Page (objPage). GetROProperty (" title ")

The title 'validation, if checkTitle string contains "keyWord", says success into a page
If Instr (checkTitle, keyWord) & lt;> 0 Then
Reporter. ReportEvent micPass, "NavigatePage", "Pass"
The Else
Reporter. ReportEvent micFail, "NavigatePage", "Fail"
End the If

The Set objBrowser=nothing
The Set objPage=nothing
The Set objLink=nothing

End the Function


The Run Error:
Always identify the object "[Link]" (of class Link). Verify that this object 's properties match an object currently displayed in your application. The

Master, I am a beginner,

CodePudding user response:

Master? This issue has not solve

CodePudding user response:

The description of your code is what object was confused, you didn't say that when an error is where a single step, perhaps take the Link (objLink) when I couldn't find the corresponding object,

For you this code: how come I haven't type variable, not is VBS

CodePudding user response:

 Sub NavigatePage (linkName, keyWord) 

The Set objBrowser=description. The Create ()
ObjBrowser (" micClass "). Value="https://bbs.csdn.net/topics/Browser"

The Set objPage=description. The Create ()
ObjPage (" micClass "). Value="https://bbs.csdn.net/topics/Page"

The Set objLink=description. The Create ()
ObjLink (" HTML tag "). Value="https://bbs.csdn.net/topics/A"
ObjLink (" text "). The value=https://bbs.csdn.net/topics/linkName

Dim checkTitle
Browser (objBrowser.) Page (objPage). The Link (objLink). Click
CheckTitle=Browser (objBrowser) Page (objPage). GetROProperty (" title ")

The title 'validation, if checkTitle string contains "keyWord", says success into a page
If Instr (checkTitle, keyWord) & lt;> 0 Then
Reporter. ReportEvent micPass, "NavigatePage", "Pass"
The Else
Reporter. ReportEvent micFail, "NavigatePage", "Fail"
End the If

The Set objBrowser=nothing
The Set objPage=nothing
The Set objLink=nothing

End Sub


Use method, do not use function; VB on the methods and functions there is obvious difference,
If you use the Function must have the As [XX] type, and finally have the corresponding Return;
  • Related