Forum Discussion

m1013864's avatar
m1013864
Occasional Contributor
14 years ago

Evaluate XPath is slow in some systems but not in all

Hi,



I am facing a typical problem where the EvaluateXPath method is running slowness in some VMs but not in all. We have a set of VMs having all the settings same which is use to run the test suit every day.



In one VM the speed at which the EvaluateXPath works is very fast but in other VM the spped is so slow that the script execution fails with an exception without any description("Exception:").



The scripts always runs slower on a perticular VM.
  • m1013864's avatar
    m1013864
    Occasional Contributor
    I am pasting one sample script which runs very slow on a perticular machine but is very fast in other machines. I am unable to find the exact command where the exception occurs as the exception always goes in the catch block.... Although exception is not the major issue and is not always seen but the script execution becomes very slow and the script return false as it becomes unable to find the target object alhough is on the screen and the same script runs perfect in other system.



    Is there any settings issue in test complete. Web testing plugin is present there.




    // Function CreateGUIAccount : To click on the Panel Header buttons on the DVS GUI


    // Arguments : 3


    // 1. userName: New User Name to be created eg: admin


    // 2. userPerm : Permission of the user to be assigned eg: superadmin


    // 3. userPwd : Password for the new User. eg:Password


    // Returns true if the account is created successfully else returns false



    function CreateGUIAccount ( userName, userPerm, userPwd )


    CreateGUIAccount ( userName, userPerm, userPwd )

    {


    try


    {


    var page=Sys.Process("iexplore").Page("*");


    var createAccountBtnXpth="//DIV[@id='settingsContainer']//DIV[@id='settingsAdminAccounts']//DIV[@class='SettingsAccounts']//SPAN[@class='capabilities-block cap-admin-user-add vacButtonContainer']//BUTTON";


    var userCredTxtBxXpth="//DIV[@id='add_user_dialog']//TABLE[@class='TableFirewallPolicy']//INPUT";


    var buttonsXpth="//DIV[@id='add_user_dialog']//DIV[@class='dialogButtonContainer']//BUTTON";


     


    if(!ClickPanelTab(DvsPanelTabList.Settings))


    return false;


     


    if (! ClickSettingsTabList(SettingsTab.AdministrativeAccounts) )

    return false;


     


    //Get the button to create user


    createAccountBtn = ReturnXPathObjects(createAccountBtnXpth);


     


    if(createAccountBtn == null)


    {


    Log.Message("Create account button not found");


    return false;


    }


     


    if(!createAccountBtn[0].VisibleOnScreen)


    {


    Log.Message("Create user button not enabled");


    return false;


    }


     


    createAccountBtn[0].Click();


     


    //Get the table containing Snap Shot


    userCredTxtBx = ReturnXPathObjects(userCredTxtBxXpth);


     


    if(userCredTxtBx == null)


    {


    Log.Message("Text box for entering new users credentials not found");


    return false;


    }


     


    //Enter the user name


    userCredTxtBx[0].setText(userName);


    //Enter Privilege


    userCredTxtBx[1].setText(userPerm);


    //Enter Password


    userCredTxtBx[3].setText(userPwd);


    //Re-enter password


    userCredTxtBx[4].setText(userPwd);


     


    //Get the object of both the buttons


    buttons = ReturnXPathObjects(buttonsXpth);


     


    if(buttons == null)


    {


    Log.Message("Add User/Cancel buttons not found");


    return false;


    }


     


    //Click on Add user button


    buttons[0].Click();


    page.wait();


     


    //Wait for the error message to appear


    if(page.Panel("net_error_dialog").WaitProperty("Visible", true, 15000))


    {


    if(!page.Panel("net_error_dialog").WaitProperty("Visible", false, 20000))


    {


    return false;


    }


    }


     


    //Check whether the user is created


    if(FindUser(userName, userPerm))


    {


    return true;


    }


     


    return false;


     


    }


    // Catch and log exception if any and return false


    catch ( exception )


    {


    Log.Warning("Exception: "+ exception.description);


    return false ;


    }


    }



    //Function to find the user from the table


    //Accepts 2 arguments


    // arg1: User Name


    // arg2: user Permission


    //Return true if the user is found



    function FindUser(userName, userPerm)



    FindUser(userName, userPerm)

    {


    try

     



    {


    var page=Sys.Process("iexplore").Page("*");


    var usersTableXpth="//DIV[@id='settingsAdminAccounts']//DIV[@class='SettingsAccounts']//TABLE[@id='Accounts']";


    var rowCount;


     


    for(index = 0; index < 3; index ++)


    {


    //Get the web object of the button

     



    usersTable = ReturnXPathObjects(usersTableXpth);


     


    if(usersTable != null)


    {


    break;


    }


    }


     


    if(index == 3)


    {


    Log.Message("User table not found");


    return false;


    }


    //Get the number of rows in the table

     



    rowCount=usersTable[0].RowCount;


    Log.Message(rowCount);


     


    for(count=0; count<rowCount; count++)


    {


    if(aqString.Find(usersTable[0].Cell(count, 0).outerText, userName, 0, true)!= -1)


    {


    if(aqString.Find(usersTable[0].Cell(count, 1).outerText, userPerm, 0, true) != -1)


    {


    return true;


    }


    }


    }


     


    return false;


     


    }


    catch(exception)


    {


    Log.Warning(exception.description);


    return false;


    }


    }

  • Hi,


    The speed of the script run can depend on a browser version. For example, the script can run slowly for pages opened in Internet Explorer version 6 or 7. In this case, consider updating the browser version.

  • m1013864's avatar
    m1013864
    Occasional Contributor
    I am using IE 8 and the same script runs fast in some system but not in others. Could you pls help me out?
  • Hi,


    What version of TestComplete are you using? If you use a version that is earlier than 8.70, try to update TestComplete to version 8.70 and reproduce the problem.

  • m1013864's avatar
    m1013864
    Occasional Contributor
    Could you please help me find answers of the following so that we can use TC-8.7



    1. We are using 8.6. Is upgrade to 8.7 free or it involved some extra cost?



    2. Can the same name mapping file be used in both 8.6 and 8.7 or if once the name mapping file is used in 8.7 it cannot be used in 8.6 as we observed while upgrading from 7.5 to 8.6



    3. Has the default object name that test complete assigns to .net object while name mapping has changed. We have observed the default object naming convention has changed when we upgraded from 7.5 to 8.6



    Thank you very much for the help !!!!


  • Hi,


    1. We are using 8.6. Is upgrade to 8.7 free or it involved some extra cost?


    You can upgrade TestComplete to version 8.7 for free.


    2. Can the same name mapping file be used in both 8.6 and 8.7 or if once the name mapping file is used in 8.7 it cannot be used in 8.6 as we observed while upgrading from 7.5 to 8.6


    You can  make a copy of your project and use the created duplicated project in the new version of TestComplete. Thus, your original project will be available for TestComplete 8.6.


    3. Has the default object name that test complete assigns to .net object while name mapping has changed. We have observed the default object naming convention has changed when we upgraded from 7.5 to 8.6


    Object names will not be changed as you upgrade the TestComplete minor version.