I am attempting to write a function in TestComplete using Python, to access a specific button. The webpage has three buttons, and if I use TestComplete's 'Record Script' function, it returns Aliases.browser.xyz.formJsMainform.panelContent.buttonContinue.ClickButton() for each of the buttons.

These buttons do have their own specific text ('Submit', 'Print', and 'Download'). I've looked at the documentation and I'm aware you can search by XPath, however I've not been successful when I've tried.

Would anyone be able to write/show me a basic method of accessing a button using TestComplete's built-in functions?

Here is an example buttons properties in the Object Browser.

Example of buttons properties in Object Browser


Assuming you're starting with the object browser, and your button has a named property such as caption (the TestComplete Object Explorer will give you this information), I'd use the Find() function:

button = browser.Find("Caption", "Submit", 1000)

Find works with any object TestComplete can detect.

Update: given the information from the properties window, I'd start with:

button = browser.Find("contentText", "Submit", 1000)


button = browser.Find("ObjectLabel", "Submit", 1000)

(Note: 1000 is the depth to search: it's unlikely the button is buried that deep in the object hierarchy, based on the default name mapping, which TestComplete tends to make almost the same as the actual object tree)

  • Thanks Kate. I tried using the property name in various ways: browser.Find("button(0)", "Submit", 1000) | Aliases.browser.xyz.formJsMainform.panelContent.buttonContinue.Find("Button(2)", "Submit", 1000).ClickButton() etc... But I still am unable to get this to work. Would you be able to update your answer with a more specific example using the photo I've now added to my question? – Edward_Haigh Jun 1 '17 at 10:54
  • Update: If you go into the advanced properties for an object, you will find its 'full name'. While this may contain some hard-coded values you will need to store as variables somewhere else, it is the ultimate 'get-out-of-jail' tool if you're struggling to access something. – Edward_Haigh Jun 1 '17 at 12:43

use the below format:

"Button = Sys.Browser(" * ").Page(" * ").Find("ObjectLabel", "Submit", 1000)"
  • 2
    Hi Sathish, welcome to SQA! I'm not the downvoter, but it was likely given as you've answered a two year old question with an already accepted answer so it doesn't provide much value. If you're able to explain why this is a better or more helpful answer, and why it would work, then the community will be more likely to upvote it :) Thanks! – trashpanda Apr 29 '19 at 9:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.