7 Replies Latest reply on Dec 17, 2013 5:02 PM by Jon Trotter

    UI Element Not Found

    Jon Trotter

      I have tried and tested many settings and have not been able to get this to work.  Trying to run this script using TM ART 4.2 and recording in Workbench 4.2.  The recording runs fine, the playback runs fine, but when executing it will fail in the same spot and seems to happen for ALL AJAX-based testing.  I've tried using the low-level test and the standard HTTP test, both will work for the recordings and will run fine for a short period, but there is too much dynamic content changing (CSS and JS file names, etc.), so this seems to be the better method from how I understand TM ART. However, when I deploy the monitor, the script fails at the SAME spot every time and for others it fails multiple times and elsewhere (for the various sites I'm testing).

       

      Here is the script. The highlighted line is where the logs shows it is failing.  This is the only error when running the script.  I've looked online and the BrowserVerifyProperty and BrowserFind functions I don't think would help in this scenario as the support pages have mentioned.  I have made some setting changes to the user Profile I'm working with during recording, but nothing yields any changes, they all fail the same with the "BrowserEngine: 29 UI element not found" error.

       

      Any recommendations or ideas how to resolve this?

       

       

      // ----------------------------------------------------------------------

      // Recorded 11/13/2013 by BMC TM ART Recorder v4.2.0.5498

      // ----------------------------------------------------------------------

      // Rule set "ASP.NET ViewState"

      //  * Rule "Parse and Replace __VIEWSTATE"

      //  * Rule "Parse and Replace __EVENTVALIDATION"

      // Rule set "Don't Modify Response Headers"

      //  * Rule "Suppress modification of any server response headers."

      // ----------------------------------------------------------------------

       

       

      @codepage(1252)

       

       

      benchmark BMCTMARTRecorder

       

       

      use "Kernel.bdh"

      use "BrowserAPI.bdh"

       

       

      dcluser

        user

          VUser

        transactions

          TInit           : begin;

          TMain           : 1;

       

       

      var

       

       

      dclrand

       

       

      dcltrans

        transaction TInit

        begin

        end TInit;

       

       

        transaction TMain

        var

          wnd1 : number;

        begin

          BrowserStart(BROWSER_MODE_DEFAULT, 1044, 396);

          BrowserNavigate("http://www.olivegarden.com/", "Navigate_http://www.olivegarden.com/ (#1)");

          wnd1 := BrowserGetActiveWindow("wnd1");

          //ThinkTime(6.7);

          BrowserClick("//INPUT[@id='LocationString']", BUTTON_Left);

          //ThinkTime(4.0);

          BrowserSetText("//INPUT[@id='LocationString']", "32809");

          BrowserClick("//BUTTON[@id='LocationButton']", BUTTON_Left, "Click, BUTTON, textContents=GO (#1)");

          //ThinkTime(26.4);

          BrowserClick("//A[@textContents='Gift Cards']", BUTTON_Left, "Click, A, textContents=Gift Cards (#1)");

          //ThinkTime(7.3);

          BrowserClick("//IMG[@border='0'][2]", BUTTON_Left, "Click, IMG (#1)");

          //ThinkTime(13.0);

          BrowserListBoxSelect("//SELECT[@onchange='function anonymous()*']", "$25",

            "ListBoxSelect, SELECT, name=ctl00$ContentPlaceHolder1$ctl00$ddlAmount (#1)");

          //ThinkTime(7.3);

          BrowserClick("//INPUT[@id='ctl00_ContentPlaceHo*']", BUTTON_Left,

            "Click, INPUT, name=ctl00$ContentPlaceHolder1$ctl00$ImageButton1 (#1)");

          //ThinkTime(6.4);

          BrowserRadioButtonSelect("//INPUT[@value='rbSelectCard']");

          BrowserClick("//INPUT[@maxLength='50']", BUTTON_Left);

          BrowserSetText("//INPUT[@maxLength='50']", "You");

          //ThinkTime(2.1);

          BrowserSetText("//INPUT[@maxLength='50'][2]", "Me");

          BrowserClick("//INPUT[@maxLength='36']", BUTTON_Left);

          //ThinkTime(3.7);

          BrowserSetText("//INPUT[@maxLength='36']", "This is the text input");

          //ThinkTime(3.2);

          BrowserClick("//INPUT[@onclick='function onclick()*W*']", BUTTON_Left,

            "Click, INPUT, name=ctl00$ContentPlaceHolder1$ctl00$CompleteStep2 (#1)");

          //ThinkTime(8.3);

          BrowserDlgSetButton("Message from webpage #1", "OK");

          BrowserClick("//A[@id='ctl00_ContentPlaceHo*']", BUTTON_Left, "Click, A, textContents=Remove (#1)");

          BrowserDlgStop();

        end TMain;

        • 1. Re: UI Element Not Found
          Jon Trotter

          Does anyone have suggestions on this? 

          • 2. Re: UI Element Not Found
            Christophe Oggeri

            Hi minigts,

             

            I see you have a wildcard caracter : ctl00_ContentPlaceHo*'

             

            Did you tried to record the script again when you have an error to check if the component has the same id ?

            • 3. Re: UI Element Not Found
              Jon Trotter

              Hi Christophe,

               

              I haven't done that, but will go through and see if that will yield some answers.  I did change the settings on the Execution server to run as a process and the AJAX scripts ran fine at that point, no errors.  However, after a period of time, the process either stops or does not spawn new processes, so looking into that.  I'm wondering if the processes aren't being "released" and then too many are running and then it fails.  Going to dig through the documentation, but so far I haven't seen a best practices guide.  Also going to scour the forums to see what all is out there and available.  I'll report back when I have more information.

              • 4. Re: UI Element Not Found
                Jon Trotter

                Just found two threads,

                 

                https://communities.bmc.com/message/293203#293203

                 

                https://communities.bmc.com/message/376333#376333

                 

                Makes sense why it's failing, unsure the value in this the processes can't run as SYSTEM, although I can see the security risk.  Just curious, what is normal protocol to have the process run to do executions?  Just when someone logs in locally to run specific tests?

                • 5. Re: UI Element Not Found
                  Hal DeVore

                  We have some customers who run Execution Servers as a process.  Most use an autologon setup. 

                   

                  Given the autologin, there are two approaches to security:

                   

                  1. Tight physical security over the ES.  Lock in a closet, no keyboard/display, etc.
                  2. Force screenlock at boot after the autologin

                   

                  I know of one customer whose security procedures mandate login using a controlled-access card.  If the ES ever reboots, they have someone assigned to physically walk up to it, log on, and lock the screen.

                   

                  --Hal

                  • 6. Re: UI Element Not Found
                    Jon Trotter

                    Thanks for the info Hal.  I'm going to check with the customer and see if this is something that will be within the guidelines of their security settings/policies.

                     

                     

                    Made a little progress on another script that was throwing the same error.  At the end, removing an item from a cart was failing with the last two clicks.  Went through it step by step and was able to update/modify the last two entries, similar to the one above.

                     

                    The first one was the name, updated this to ID and used the same format.  It was set to INPUT@value=on.

                     

                        BrowserCheckBoxSelect("//INPUT[@id='ctl00_ContentPlaceHolder1_ctl00*']", CHECKBOX_CHECKED);

                        //ThinkTime(5.2);

                     

                    This is the original one commented out.  I set it to what is in one of the previous steps, which is the onclick function for the button itself.  The script should check a box and remove the line item, but for some reason I don't think it was checking the box and therefore, couldn't remove the item that should have been selected.  Testing shows it is running fine after 2 periods (15 minutes), so going to continue to plug away at these others and see where I can get.

                     

                        //BrowserClick("//INPUT[@alt='Click here to update']", BUTTON_Left, "Click, HTML (#6)");

                        BrowserClick("//INPUT[@onclick='function onclick(eve*']", BUTTON_Left, "Click, HTML (6)");

                     

                    I'll update more, but I appreciate the comments and suggestions, this is very helpful to get my brain troubleshooting.

                    • 7. Re: Re: UI Element Not Found
                      Jon Trotter

                      I did validate the value and it is correct.  I think what is happening is, the script clicks the button to remove the item from the shopping cart, that opens a pop-up window to confirm and then it goes back to the page and then clears the cart.  I think the test is expecting to validate the remove button upon confirmation, but since the cart is cleared, it can't so it fails.  Which is really validation that it worked, but the test sees it as an error.

                       

                      Is there a way to do the click, get the pop-up and then end the script?  I can't comment out the Remove link since that is what causes the extra window to show.

                       

                      This actually happens after the BrowserClick function, but it's recorded this way and test fine this way.  Tried swapping and got an error about a window being open....It's a Java function in the link.  Can I add to the script the Java function as the action before the BrowserDlgSetButton function?

                          BrowserDlgSetButton("Message from webpage #1", "OK");

                          BrowserClick("//A[@id='ctl00_ContentPlaceHo*']", BUTTON_Left, "Click, A, textContents=Remove (#1)");


                      Actually understanding this better, I think the function is storing the answer for the pop-up dialogue, not performing the function prior.  Just don't get it.  It test fine over and over, but on the server it doesn't.  May have to look to get an account configured for testing and just have it run on that user ID, but I feel that this shouldn't be necessary.