Vikas, Use RefreshObject before clicking *btn_Search* second time
btn_Search .Click Msgbox "btn_Search Clicked" btn_NewSearch.Click *btn_Search.RefreshObject* *btn_Search.Click* The reason being, at the time of initialization *btn_Search *it holds some properties. After clicking the button, the page may refresh. Even though the same object identification properties are used, we should refresh the object, so that it will work smooth. Please let us know whether the above solves your problem. Thanks, Uday QTP \ UFT Videos <https://www.youtube.com/user/AnemUday/videos> On Friday, 9 August 2013 11:15:49 UTC+5:30, Vikas wrote: > > Hi, > > I am facing an issue regarding the Web Objects in QTP. I am using QTP 11.0 > with IE9 browser. > > Test Code: > '**** Start of Code ******** > Dim btn_web > Set btn_Search = > Browser("Google").Page("Google").Frame("Content").WebButton("Search") > Set btn_NewSearch = > Browser("Google").Page("Google").Frame("Content").WebButton("New Search") > > btn_Search .Click > Msgbox "btn_Search Clicked" > btn_NewSearch.Click > *btn_Search.Click* > > '**** End of Code ******** > > In aobve code, the code in Red font is always giving me error that "Cannot > identify object of class webbutton". But the same button is getting clicked > 1st time, but not the 2nd time. These objects are present at the same page. > Please provide me a solution, How can I declare a web object and should use > it multiple time in the code? > > Regards > Vikas Goyal > -- -- You received this message because you are subscribed to the Google "QTP - HP Quick Test Professional - Automated Software Testing" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/MercuryQTP?hl=en --- You received this message because you are subscribed to the Google Groups "QTP - HP Quick Test Professional - Automated Software Testing" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
