Micro Focus QTP (UFT) Forums

Full Version: Click after CheckProperty to a WebElement passed via Function argument fails
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,  I'm very new to UFT.

Now I have two scripts like:

Code:
Browser().Page().WebEdit("editBoxA").Set "SomeValue"
Browser().Page().WebEdit("editBoxA").CheckProperty "value","SomeValue"
Browser().Page().WebEdit("editBoxA").Click

and:

Code:
Browser().Page().WebEdit("editBoxB").Set "SomeValue"
Browser().Page().WebEdit("editBoxB").CheckProperty "value","SomeValue"
Browser().Page().WebEdit("editBoxB").Click

So I thought it would be nice if I can use Shared Library Function like:

Code:
Public Sub checkElement(ByRef element)
  element.Set "SomeValue"
  element.CheckProperty "value","SomeValue"
  element.Click
end
then each scripts could be:
Code:
checkClick Browser().Page().WebEdit("editBoxA")
But I got an error 

> Cannot identify the object "editBoxA" (of class WebEdit)

in the line "element.click".

I tried to comment out CheckProperty line, then it works fine.

Please someone let me know of my mistake, or more efficient code.