Handling Login Windows in Non-Web Applications that Use the Open Agent

Although a non-Web application’s main window is usually displayed first, it is also common for a login or security window to be displayed before the main window.

Use the wStartup constant and the Invoke method

To handle login windows, record a declaration for the login window, set the value of the wStartup constant, and write a new Invoke method for the main window that enters the appropriate information into the login window and dismisses it. This enables the DefaultBaseState routine to perform the actions necessary to get past the login window.

You do not need to use this procedure for splash screens, which disappear on their own.

  1. Open the login window that precedes the application’s main window.
  2. Open the test frame.
  3. Click Record > Window Locators to record a locator for the window.
  4. Point to the title bar of the window and then press Ctrl+Alt. The locator is captured in the Record Window Locators dialog box.
  5. Click Paste to Editor to paste the locator into the test frame.
  6. In the Record Window Locators dialog box, click Close.
  7. Close your application.
  8. In your test frame file, find the stub of the declaration for the wStartup constant, located at the top of the declaration for the main window:
    // First window to appear when application is invoked
    // const wStartup = ?
  9. Complete the declaration for the wStartup constant by:
    • Removing the comment characters, the two forward slash characters, at the beginning of the declaration.
    • Replacing the question mark with the identifier of the login window, as recorded in the window declaration for the login window.
  10. Define an Invoke method in the main window declaration that calls the built-in Invoke method and additionally performs any actions required by the login window, such as entering a name and password.

    After following this procedure, your test frame might look like this:

    window MainWin MyApp
       locator "/MainWin[@caption='MyApp']"
       const wStartup = Login
    
       // the declarations for the MainWin should go here
       Invoke () 
          derived::Invoke ()
          Login.Name.SetText ("Your name")
          Login.Password.SetText ("password")
          Login.OK.Click ()
    
    window DialogBox Login
       locator "/DialogBox[@caption='Login']"
    
       // the declarations for the Login window go here
       PushButton OK 
          locator "OK"
    Note: Regarding the derived keyword and scope resolution operator. The statement derived::Invoke ( ) uses the derived keyword followed by the scope resolution operator ( :: ) to call the built-in Invoke method, before performing the operations needed to fill in and dismiss the login window.