Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I couldn't rectify the error in following script..pls helpme frds..
#1
Solved: 10 Years, 8 Months, 3 Weeks ago
Hi Frds,

Please help me on this following script..I have written Function script to enter username,pwd fields and verify status.
'**** Following script for ActiTIME-Login" screen.

Code:
Set un = Browser("ActiTIME-Login").Page("ActiTIME-Login").webedit("username")
Set pwd =Browser("ActiTIME-Login").Page("ActiTIME-Login").webedit("pwd")
Set btn = Browser("ActiTIME-Login").Page("ActiTIME-Login").webbutton("Login now")

Call objectset (un, "admin")
Call objectset (pwd, "manager")
Call objectset(btn)

Function objectset(testobj, sinput)
   sobjname = testobj.Tostring
   Status = verifyobjexistandenabled(testobj)
   If status = True Then
       Desc = "setting" &sinput& "in to"&sobjname
       Reporter.ReportEvent micPass, "objectset", Desc
       testobj.setsinput
      
     Else
     Exittest
      
   End If
End Function
*****************************
When i am executing the above script it's giving error message
"Type Mismatch: Status = verifyobjexistandenabled(testobj)"

Please help me what is the problem in the above script??
What is the object method we can use for verify status (For web & Windows)

Thanks in Advance,
Reply
#2
Solved: 10 Years, 8 Months, 3 Weeks ago
Usually when you get that error, the function is not associated with the test, or the function name is misspelled. Where do you have the function "verifyobjexistandenabled()" defined? If it is in an external function library file, make sure it is associated with your test. Also make sure the definition is spelled the same way.
Reply
#3
Solved: 10 Years, 8 Months, 3 Weeks ago
Thanks for your replay
Reply
#4
Solved: 10 Years, 8 Months, 3 Weeks ago
Did you figure it out?
Reply
#5
Solved: 10 Years, 8 Months, 3 Weeks ago
No. Actually, here i used Function as --Function objectset(testobj, sinput)- and in the same script only i am calling. But, i couldn't recognise what i did mistake for status verification.."Status = verifyobjexistandenabled(testobj)"

Can you please elabrate this..and also if you give some info about what are the methods will support for window applications..

Thanks in advance,
Reply
#6
Solved: 10 Years, 8 Months, 3 Weeks ago
I'm not sure what you are trying to accomplish here. You seem to be avoiding QTP native functions. I would code this something more like this:

Code:
With Browser("ActiTIME-Login").Page("ActiTIME-Login")

    If .WebEdit("username").Exist() Then
        If .WebEdit("username").GetROProperty("disabled") <> 1 And _
        .WebEdit("username").GetROProperty("readonly") <> 1 Then

            .WebEdit("username").Set "admin"
            
        End If
    End If


    If .WebEdit("pwd").Exist() Then
        If .WebEdit("pwd").GetROProperty("disabled") <> 1 And _
        .WebEdit("pwd").GetROProperty("readonly") <> 1 Then

            .WebEdit("pwd").Set "manager"
            
        End If
    End If
    
    .WebButton("Login now").Click
    
End With

If you are trying to create a reusable function for checking if the object exists and is enabled, you could create a separated function library and do something like the code below putting the ExistAndEnabled function in the separate library and associating it to your test. If it is defined in the test, the RegisterUserFunc statement must be executed before the function can be used:

Code:
Function ExistsAndEnabled(test_object)
    ExistsAndEnabled = False
    
    If test_object.Exist(0) Then
        If test_object.GetROProperty("disabled") <> 1 And test_object.GetROProperty("readonly") <> 1 Then
            ExistsAndEnabled = True
        End If
    End If
End Function
RegisterUserFunc "WebEdit", "ExistsAndEnabled", "ExistsAndEnabled"


If Browser("ActiTIME-Login").Page("ActiTIME-Login").WebEdit("username").ExistsAndEnabled() Then
    Browser("ActiTIME-Login").Page("ActiTIME-Login").WebEdit("username").Set "admin"
End If

If Browser("ActiTIME-Login").Page("ActiTIME-Login").WebEdit("pwd").ExistsAndEnabled() Then
    Browser("ActiTIME-Login").Page("ActiTIME-Login").WebEdit("pwd").Set "manager"
End If

Browser("ActiTIME-Login").Page("ActiTIME-Login").WebButton("Login now").Click

I'm not sure if this is going to help you or not, but I hope it does.
Reply
#7
Solved: 10 Years, 8 Months, 3 Weeks ago
Thanks for your helping me in this..yea, i got it...thank you very much..
Reply
#8
Solved: 10 Years, 8 Months, 3 Weeks ago
No problem. Hope I helped.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  .vbs script error when trying to insert a value in a sapguitable frebuffi 5 6,465 07-18-2013, 03:04 PM
Last Post: Staff
Exclamation SystemUtil.run script is not generating while recording in qtp 9.5..pls help me senthil.kumar 0 2,468 01-24-2013, 02:09 PM
Last Post: senthil.kumar
  Error while creating object using description.create object in VB script SarodeGirish 5 5,799 06-19-2012, 05:30 PM
Last Post: ssvali
  Receiving an IIS authentication error when replaying a.net windows application script nithya.cov@gmail.com 0 2,429 04-16-2011, 10:58 AM
Last Post: nithya.cov@gmail.com
  error in datbase script sandeep.shivnani@gmail.com 0 2,180 03-08-2011, 06:03 PM
Last Post: sandeep.shivnani@gmail.com

Forum Jump:


Users browsing this thread: 1 Guest(s)