Please Help me to Resolve Error: Wrong number of arguments or invalid property assignment: 'myob' Function file: C:\Documents and Settings\kchiplunkar\My Documents\Fun_lib.qfl Line (1): "Function Brow_open (ebrowser, eURL)".

456 views
Skip to first unread message

ketki chiplunkar

unread,
Nov 21, 2011, 6:33:51 AM11/21/11
to QTP eLearn Team
Hi Team,

I trying to build a framework. I created function for Web Button, Edit
Field, Link in the Function library and this Function library I have
then connected to a Test. Whenever I try to run the program I get the
following error

The test run cannot continue due to an unrecoverable error.

Wrong number of arguments or invalid property assignment: 'myob'

Function file: C:\Documents and Settings\kchiplunkar\My Documents
\Fun_lib.qfl
Line (1): "Function Brow_open (ebrowser, eURL)".


Please let me know how to resolve this error

My Functions library and Test contains is as follows

Function Library
Function Brow_open(ebrowser, eURL)
systemutil.Run ebrowser, eURL

End Function

Function Brow_Close ()
Browser("title:=.*").Close
End Function

Function Ed_Bo (Edit_name, text_variable)
Set myp= Browser("title:=.*").Page("title:=.*")
Set myob= description.Create()
myob("html tag").value= "INPUT"
myob("name").value= Edit_name
myp.WebEdit(myob).Set text_variable
End Function

Function Wb_But (But_name)
Set myp = Browser ("title:=.*").Page ("title:=.*")
myob = description.Create()
myob("type").value ="submit"
myob("name")= But_name
myp.WebButton(myob).Click
End Function

Function We_li (name_link)
Set myp =Browser ("title:= .*").Page( "title:= .*")
myob = description.Create()
myob("name").value = name_link
myob("html tag").value = "A"
myp.Link(myob).Click
End Function


Test

Dim vbrowser, vurl, vemail, vpass
vbrowser = "iexplore.exe"
vurl = "gmail.com"
vemail = "fieldchoi...@gmail.com"
vpass = "client123"

'Brow_open vbrowser, vurl
'Ed_Bo "Email", vemail
'Ed_Bo "Passwd", vpass


Dim xlpath, row_tc, row_ts, row_td, TCid, kyword
xlpath = "C:\Program Files\HP\QuickTest Professional\Tests
\Test1\Methods\KeyDrivenFramework.xls"
datatable.AddSheet "TC"
datatable.AddSheet "TS"
datatable.AddSheet "TD"

datatable.ImportSheet xlpath, "TestCase", "TC"
datatable.ImportSheet xlpath, "TestSheet", "TS"
datatable.ImportSheet xlpath, "TestData", "TD"

row_tc = datatable.GetSheet ("TC").GetRowCount()
print "TestCase Row Count" & row_tc
row_ts = datatable.GetSheet ("TS").GetRowCount()
print "TestSheetRow Count" & row_ts
row_td = datatable.GetSheet ("TD").GetRowCount()
print "TestData Row Count" & row_td

For i=1 to row_tc
datatable.GetSheet("TC").SetCurrentRow(i)
If datatable.value("Execute", "TC")= "Y"Then
TCid =datatable. value ("TCId", "TC")
print "Test Case ID Is Flagged Y= " & TCid
For j=1 to row_ts
datatable.GetSheet("TS").SetCurrentRow(j)
If datatable.Value( "TCId", "TC")=datatable.Value("TCId","TS")Then
kyword = datatable.Value("Keyword","TS")
print "Keyword is " & kyword
keyword_call kyword
End If
Next
End If
Next


Function keyword_call (fkyword)
Select Case fkyword
Case"Brow_open"
Brow_open vbrowser, vurl
Case "Ed_Bo1"
Ed_bo "Email",vemail
Case "Ed_Bo2"
Ed_Bo "Passwd", vpass
Case "Wb_But"
Wb_But "Sign in"
Case "We_li1"
We_li vemail
Case "We_li2"
We_li "Sign out"
Case Else
msgbox "Keyword Funtion Not available"
End Select
End Function
wait 20

Malini Binu

unread,
Nov 21, 2011, 9:03:56 AM11/21/11
to ketki chiplunkar, QTP eLearn Team

Hello Ketki,
 
I believe the error is when you are calling the function.Since ur function is not returning any value no need of paranthesis,you need to mention
 
Brow_open ebrowser, eURL                  in line  1 of ur main script
 
Try this and let me know if you still have a problem.
 
 
Thanks,
Malini

Reshma Sumanth

unread,
Nov 21, 2011, 1:18:59 PM11/21/11
to Malini Binu, ketki chiplunkar, QTP eLearn Team
Hi Ketki

Try out myobj(html_tag).value = "INPUT"

See if the property matches exactly as per the AUT.You have given html tag...maybe it does not recognise that property  for myobj.

Let me know if you have resolved it and how?

Thanks
Reshma

Ketki Chiplunkar

unread,
Nov 22, 2011, 12:54:49 AM11/22/11
to Reshma Sumanth, Malini Binu, QTP eLearn Team
Hi Malini and Reshma,

I am still not able to resolve this issue. I really am not getting where am I mistaking.I have checked the properties, changed the name of the object still getting the same error
--
Ketki 

fizza

unread,
Nov 22, 2011, 5:24:26 PM11/22/11
to QTP eLearn Team
Did you declare this variable "text_variable"???

On Nov 21, 9:54 pm, Ketki Chiplunkar <ketki.c...@gmail.com> wrote:
> Hi Malini and Reshma,
>
> I am still not able to resolve this issue. I really am not getting where am
> I mistaking.I have checked the properties, changed the name of the object
> still getting the same error
>

> On Mon, Nov 21, 2011 at 11:48 PM, Reshma Sumanth <reshmasuma...@gmail.com>wrote:
>
>
>
>
>
> > Hi Ketki
>

> > Try out myobj(*html_tag*).value = "INPUT"


>
> > See if the property matches exactly as per the AUT.You have given html
> > tag...maybe it does not recognise that property  for myobj.
>
> > Let me know if you have resolved it and how?
>
> > Thanks
> > Reshma
>

> > On Mon, Nov 21, 2011 at 6:03 AM, Malini Binu <malini.b...@gmail.com>wrote:
>
> >> Hello Ketki,
>
> >> I believe the error is when you are calling the function.Since ur
> >> function is not returning any value no need of paranthesis,you need to
> >> mention
>

> >> *Brow_open ebrowser, eURL*                  in line  1 of ur main script


>
> >> Try this and let me know if you still have a problem.
>
> >> Thanks,
> >> Malini
>

> >>> vemail = "fieldchoice.cli...@gmail.com"

> Ketki- Hide quoted text -
>
> - Show quoted text -

Ketki Chiplunkar

unread,
Nov 22, 2011, 11:52:24 PM11/22/11
to fizza, QTP eLearn Team
Hi Team, 

I could able to resolve the issue. There was a error in the script I created for one of the functions. In the highlighted line I forgot to write myob("name").value=But_name
 
Function Wb_But (But_name)
> >>>   Set myp = Browser ("title:=.*").Page ("title:=.*")
> >>>   myob = description.Create()
> >>>   myob("type").value ="submit"
> >>>   myob("name")= But_name         
> >>>   myp.WebButton(myob).Click
> >>> End Function

Thanks 
Ketki 
--
Ketki 

vsv

unread,
Nov 22, 2011, 5:34:12 PM11/22/11
to QTP eLearn Team
Hi Ketki,

Giving an idea to dig out on which step you got the problem:

Since you are using the same "myob" in all functions that you have
created it might be tough to find where exactly the problem is. Why
don't you replace "myob"
with some unqiue object name such as "myob1","myob2" etc., and check
in which function the problem is occurring?

Vanitha.


On Nov 21, 9:03 am, Malini Binu <malini.b...@gmail.com> wrote:
> Hello Ketki,
>
> I believe the error is when you are calling the function.Since ur function
> is not returning any value no need of paranthesis,you need to mention
>

> *Brow_open ebrowser, eURL*                  in line  1 of ur main script


>
> Try this and let me know if you still have a problem.
>
> Thanks,
> Malini
>

> > vemail = "fieldchoice.cli...@gmail.com"

> > wait 20- Hide quoted text -

vsv

unread,
Nov 22, 2011, 5:33:14 PM11/22/11
to QTP eLearn Team
Hi Ketki,

Giving an idea to dig out on which step you got the problem:

Since you are using the same "myob" in all functions that you have
created it might be tough to find where exactly the problem is. Why
don't you replace "myob"
with some unqiue object name such as "myob1","myob2" etc., and check
in which function the problem is occurring?

Vanitha.

> vemail = "fieldchoice.cli...@gmail.com"

Reply all
Reply to author
Forward
0 new messages