Control the click operation of a button

Updated at:

Use the Execute() property to control the click operation of a component. This topic describes how to automatically perform a click operation on a button. The More Menus button is used as an example.

  • Demonstration

    • Before a clickShow

    • After a clickCustom-After Click

  • Syntax

    expression.CommandBars(CommandBarId).Execute()

    expression: the document type application object.

  • Example

    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      // Obtain the More Menus button on the page.
      const moreMenus = await app.CommandBars('MoreMenus');
    
      // Specify that the specific event is triggered after 3,000 microseconds.
      setTimeout( async () => {
        // Click the More Menus button.
        await moreMenus.Execute();
      }, 3000);
    }