Forum Discussion

sarya's avatar
sarya
Frequent Contributor
14 years ago

Difficulty in recognising some objects on right-click menus for .Net application

Hi,



I am testing a .net application .I open an xls file in the tool under testing. In the screenshot,I am creating a block in the excel file and then delete it. On the right-click menu displayed in screenshot,I need to click 'Delete Block'.The recorded script is like this but when I run it everything runs fine but somehow it does not click the option 'Delete Block' and gives an error :

"There was an attempt to perform an action at point (71, 71) which is invisible or out of the window bounds. "


function Test1()  /create and delete block

{

var burster;

var workbookView;

burster = Sys.Process("Burster");

workbookView = burster.frmSpreadsheetGear.WinFormsObject("Panel1").TableLayoutPanel1.WorkbookView;

workbookView.Click(391, 113);

workbookView.ClickR(391, 113);

workbookView.PopupMenu.Click("Convert Cell to Block");

burster.frmDefineBlock.VBObject("cmdOK").ClickButton();

workbookView.Click(684, 193);

workbookView.ClickR(469, 123);

workbookView.PopupMenu.Click("Delete Block");  //Delete the block.

}



Also if I only use this function separately to delete the block,it works fine.Everything is same ,its just that I tried deleting the block using a separate function but lines of code.

function Test2()

{

var workbookView;

workbookView = Sys.Process("Burster").frmSpreadsheetGear.WinFormsObject("Panel1").TableLayoutPanel1.WorkbookView;

workbookView.ClickR(415, 125);

workbookView.PopupMenu.Click("Delete Block");

}



Please help me with this issue ..



Thanks,

Sumedha


Test1()  /create and delete block { burster; workbookView;burster = .Process("Burster");workbookView = burster.frmSpreadsheetGear.WinFormsObject("Panel1").TableLayoutPanel1.WorkbookView;workbookView.Click(391, 113);workbookView.ClickR(391, 113);workbookView.PopupMenu.Click("Convert Cell to Block");burster.frmDefineBlock.VBObject("cmdOK").ClickButton();workbookView.Click(684, 193);workbookView.ClickR(469, 123);workbookView.PopupMenu.Click("Delete Block");  //Delete the block.}Also if I only use this function separately to delete the block,it works fine.Everything is same ,its just that I tried deleting the block using a separate function but lines of code. Test2(){ workbookView;workbookView = .Process("Burster").frmSpreadsheetGear.WinFormsObject("Panel1").TableLayoutPanel1.WorkbookView;workbookView.ClickR(415, 125);workbookView.PopupMenu.Click("Delete Block");}Please help me with this issue ..Thanks,Sumedha

13 Replies

  • sarya's avatar
    sarya
    Frequent Contributor
    Hi David,



    I included that piece of code into the script that I have after the right-click option line of code.



    **How long it takes for the menu to be opened after a right-click is performed?**

    It appears that the menu does not take that long to appear but how can we exactly know the time when it appeared. I tried different wait times 10,20,30 secs but none of them worked to click in the menu. Also it kept on giving me the warning message that pop-up window has not appeared in this many seconds but also if it is not taking that much time to open the menu then why the warning message is still displayed with any of the wait times 10,20 or 30.



    **Please note that this solution can work only if the popup menu appears slowly indeed.**

    The other way might be it is taking not that much time to open up not even 10 seconds.



    Thanks,

    Sumedha

  • Hi Sumedha,





    In this case, you can try this version of the script:

    function waitForPopupMenu(timeout)

    {

      if (null == timeout) {

        var timeout = 10000; 

      }

      

      var popup;

      var endTime = GetTickCount() + timeout;

      

      do {

        delay(250);

        popup = burster.WaitWindow("#32768"); 

        if (GetTickCount() > endTime) break;

      } while (false == popup.Exists);

      

      if (false == popup.Exists) {

        Log.Warning("The popup menu window has not appeared in " + (timeout / 1000) + " seconds.");

      }

    }






    If this does not work either, we need to get your application in order to investigate the problem. If this is possible, please contact us directly via the Contact Support form.
  • sarya's avatar
    sarya
    Frequent Contributor
    Hi David,



    I tried different ways but nothing worked ,then I figured out the problem is due to application itself as it has overlapping issues,as soon as I right-click any cell,the control just moves beneath some layers of the excel displayed in the application.Also it does not work fine when the application is displayed on the full screen .So I tried enabling the option 'Ignore overlapping windows' and did not use the application in full screen mode and that worked. 



    Appreciate your continuous and elaborated help on this issue .



    Thanks,

    Sumedha