6 Replies Latest reply: Feb 2, 2012 8:27 AM by 820608 RSS

    How to know if an alertdialog exists

    820608
      Hi everyone,

      I am developing an Oracle EBS/Forms script, and I wanted to know if an alertdialog appears at a t moment...

      What is the code I need to insert on my if ?

      if( /*nca.alertDialog("Forms") != null*/ true ) {
                          
           nca.alertDialog(831, "Forms").clickButton(1, "");
           nca.textField(832, "IND_COD_ETU_0").select(0, 8, 8, "1");
           ....
      }

      Thanks,

      Benoît.
        • 1. Re: How to know if an alertdialog exists
          834498
          Bonjour Benoit
          There is a probably better solution to verifies whether a particular form/alertdialog is loaded
          Something like that (for a window, to be changed to alertdialog)
          if(forms.window("//forms:window[(@name='GROUPS_DETAIL')]").exists()){
               info("exists");
               }else{
               info("does not exist");
               }


          JB
          • 2. Re: How to know if an alertdialog exists
            820608
            The problem is I don't have the exists() function for an alertdialog or for a window...
            • 3. Re: How to know if an alertdialog exists
              834498
              Benoit
              I was wrong because I was referring to Functional Test scripts, and not Load Test script, sorry.
              Better solution is to use activate and check if the result is correct (OpenScript variable {{result.code}} to test)

              nca.window(4201, "FOLDER").activate();
              getVariables().set("maVar", "{{result.code}}",Variables.Scope.GLOBAL);
              if (eval("{{maVar}}").compareTo("PASS") == 0)
              { // code }
              else
              { // other code }
              }

              JB
              • 4. Re: How to know if an alertdialog exists
                820608
                JB, what represents "{{result.code}}" ? Is it the result of last instruction of my code ?

                And how to check an alertDialog because there is no activate function.

                Thanks,

                Benoit.
                • 5. Re: How to know if an alertdialog exists
                  834498
                  "{{result.code}}" returns the status of the last action.

                  You can try a getObjectDetails() or getProperty() to see if there is something in it or you can just try the action you want to perform and catch the java exception (as shown below)

                  try
                  {
                  fail("nice");
                  }
                  catch(UserCausedFailureException e)
                  {
                  System.out.println("execution caught");
                  }

                  JB
                  • 6. Re: How to know if an alertdialog exists
                    820608
                    I tried to catch the exception as below :

                    boolean alertDialogAffiliation = true;
                    try {
                    nca.alertDialog(831, "Forms").clickButton(1, "");
                    } catch (Exception e) {
                    alertDialogAffiliation = false;
                    }
                         
                    if( alertDialogAffiliation ) {
                    // Code if there is the alertDialog.
                    ....
                    }

                    althought I catch the exception, I obtain on console :

                    *15:16:29,700 WARN [OracleFormsPlayback] Forms disconnected due to exception*

                    and the next code (after the if, cause alertDialogAffiliation is false) can't be executed, because I am disconnected.

                    Benoit.