While recording a basic login script in QTP 11 version I faced the following issue.
On Login page, the Login button is enabled only when password is entered.
I was able to login to home page manually but when I play back my script, it failed at the last step and displayed error "Object is disabled" .
During the play back script , I observed that QTP had enter the Login & Password values but then also Login button was not enabled.
I tried giving the wait time also before the "Login" Click but it didn't work.
Sample Code:
SystemUtil.Run "iexplore.exe", "www.xyz.com"
Browser("xxxxx").Page("xxxxx").WebEdit("UserName").Set "Test"
Browser("xxxx").Page("xxxxx").WebEdit("pwd").SetSecure "ewuy472"
Browser("xxxx").Page("xxxxx").WebButton("login").Click
Following are the ways we can handle this:
Approach:
Firing the handled event using FireEvent. In this approach we need to look into the HTML and see which event has a handler and fire the same after changing the value of the web-edit box.
SystemUtil.Run "iexplore.exe", "www.xyz.com"
Browser("xxxxx").Page("xxxxx").WebEdit("UserName").Set "Test"
Browser("xxxx").Page("xxxxx").WebEdit("pwd").SetSecure "ewuy472"
Browser("xxxx").Page("xxxxx").WebEdit("pwd").FireEvent "onkeyup"
Browser("xxxx").Page("xxxxx").WebButton("login").Click
The approach of FireEvent worked for me.
Hope you found the post useful. :)
On Login page, the Login button is enabled only when password is entered.
I was able to login to home page manually but when I play back my script, it failed at the last step and displayed error "Object is disabled" .
During the play back script , I observed that QTP had enter the Login & Password values but then also Login button was not enabled.
I tried giving the wait time also before the "Login" Click but it didn't work.
Sample Code:
SystemUtil.Run "iexplore.exe", "www.xyz.com"
Browser("xxxxx").Page("xxxxx").WebEdit("UserName").Set "Test"
Browser("xxxx").Page("xxxxx").WebEdit("pwd").SetSecure "ewuy472"
Browser("xxxx").Page("xxxxx").WebButton("login").Click
Following are the ways we can handle this:
Approach:
Firing the handled event using FireEvent. In this approach we need to look into the HTML and see which event has a handler and fire the same after changing the value of the web-edit box.
SystemUtil.Run "iexplore.exe", "www.xyz.com"
Browser("xxxxx").Page("xxxxx").WebEdit("UserName").Set "Test"
Browser("xxxx").Page("xxxxx").WebEdit("pwd").SetSecure "ewuy472"
Browser("xxxx").Page("xxxxx").WebEdit("pwd").FireEvent "onkeyup"
Browser("xxxx").Page("xxxxx").WebButton("login").Click
The approach of FireEvent worked for me.
Hope you found the post useful. :)