Forum Discussion
TanyaYatskovska
Alumni
12 years agoHi Vallalarasu,
First of all, I recommend that you use the Exists property to check whether the object exists before clicking it:
Sub T1()
Browsers.Item("iexplore").Run("http://website.com")
set FromCity = NameMapping.Sys.browser.HPage
set control = FromCity.Find("ContentText","11",1000)
If control.Exitsts Then
control.Click
Else
Log.Message("The object wasn't found")
End If
End Sub
One more note: you are searching for an object on the entire page. In this case, TestComplete is iterating through all objects unless the needed one is found. It can take some time and speed down the test execution. You need to call the Find method from one of the nearest parent of the needed object.