Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I couldn't rectify the error in following script..pls helpme frds..
#6
Solved: 11 Years, 3 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


Messages In This Thread
RE: I couldn't rectify the error in following script..pls helpme frds.. - by cdesserich - 01-26-2011, 02:35 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  .vbs script error when trying to insert a value in a sapguitable frebuffi 5 6,840 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,569 01-24-2013, 02:09 PM
Last Post: senthil.kumar
  Error while creating object using description.create object in VB script SarodeGirish 5 6,250 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,545 04-16-2011, 10:58 AM
Last Post: nithya.cov@gmail.com
  error in datbase script sandeep.shivnani@gmail.com 0 2,244 03-08-2011, 06:03 PM
Last Post: sandeep.shivnani@gmail.com

Forum Jump:


Users browsing this thread: 4 Guest(s)