Difficulty in recognising some objects on right-click menus for .Net application
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Difficulty in recognising some objects on right-click menus for .Net application
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
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Sumedha,
Probably, the workbook object is recreated or refreshed in your application. Try to get a new reference to it before the problematic line:
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 = burster.frmSpreadsheetGear.WinFormsObject("Panel1").TableLayoutPanel1.WorkbookView;
workbookView.ClickR(469, 123);
workbookView.PopupMenu.Click("Delete Block"); //Delete the block.
}
Dmitry Nikolaev
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the reply.I created a new reference for the workbook object before the last few lines of right-clicking it but that also didn't work.I am not able to figure out is there something with the script or the tool which can cause this .I am not able to create any of the scripts related to this issue.
Thanks,
Sumedha
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Sumedha,
Another possible cause of the problem is that the popup menu is not displayed instantly. In this case, TestComplete can find the menu object and the desired menu item, but when it tries to click the item, the menu is not displayed yet. If this is the case then inserting a short delay before the problematic line should help.
function Test1() /create and delete block
...
burster.frmDefineBlock.VBObject("cmdOK").ClickButton();
workbookView.Click(684, 193);
workbookView.ClickR(469, 123);
Delay(500);
workbookView.PopupMenu.Click("Delete Block"); //Delete the block.
...
Dmitry Nikolaev
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried introducing a delay but that also did not work. In fact any option on the right-click meny does not work on the second try on the same block.
It just gives the same error.
"
There was an attempt to perform an action at point (71, 71) which is invisible or out of the window bounds. "
It is surprising when I just have the delete block code in the script,it works fine but when whole script is enabled,it stops working.
When everything is same,I tried recreating object reference to workbookview and introduced delay but nothing seems to work.
Thanks,
sumedha
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Sumedha,
Please check the value of the 'Auto-wait timeout' option in your project. You can find this option in the Playback options group of the project properties editor. To open the editor, double-click the project node in the 'Project Explorer' panel and switch to the 'Properties' page. If the value of this option is less than the default value (10000 ms), set the default value and check whether the problem persists. If you have the default value, increase it to 20000 ms and check whether the problem exists in this case.
If the above does not help, please try the below script:
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);
if (true == burster.WaitWindow("#32768", 500).Exists) {
Log.Message("The old popup window still exists.");
}
workbookView.ClickR(469, 123);
var popup = burster.WaitWindow("#32768", 3000);
if (true == popup.Exists) {
Log.Message("Popup window has size " + popup.Width + "x" + popup.Height + " and located at (" + popup.ScreenLeft + ", " + popup.ScreenTop + ")", "", pmNormal, null, popup);
Log.Picture(Sys.Desktop);
}
else {
Log.Message("The new popup window is not found");
}
workbookView.PopupMenu.Click("Delete Block"); //Delete the block.
}
Execute your test project with this script, pack the entire project suite folder and send us the archive directly via the Contact Support form.
Dmitry Nikolaev
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks alot for your help on this issue .I tried increasing the time from 10000 to 20000ms and it works fine now. Also from the script that you sent,I was able to understand that it is checking for the popup or rhe right-click menu but was not able to fully get this part of the code.Are we making the script wait for the popup to appear or just checking if it appeared or not as I am always getting this part as message "The new popup window is not found" on running the script.What does popup means here?
Also now after changing auto-wait timeout to 20000ms,when I reverted back to 10000ms ,it nows works fine clciking the option correctly ?
workbookView.ClickR(469, 123);
var popup = burster.WaitWindow("#32768", 3000);
if (true == popup.Exists) {
Log.Message("Popup window has size " + popup.Width + "x" + popup.Height + " and located at (" + popup.ScreenLeft + ", " + popup.ScreenTop + ")", "", pmNormal, null, popup);
Log.Picture(Sys.Desktop);
}
else {
Log.Message("The new popup window is not found");
}
Thanks again for your help.
Sumedha
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Sumedha,
The code I sent just waits for the popup menu object window to check whether it exists. The code I inserted after the right-click waits for 3 seconds when the window appears. Since the code posts a message that this window is not found, it seems that the popup appears with a delay and this can be a cause of the problem.
Dmitry Nikolaev
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the explanation.I tried increasing the auto-wait timeout in one of the projects and tried the script,it works fine but with the same properties when I tried in another project,it is not working. So if the pop-up window is not appearing on the time,so how can we solve the problem ? .In one of the projects where I need the script,it is not working even after increasing auto-wait timeout .
Thanks,
Sumedha
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Sumedha,
You can try to wait until the popup menu window appears. For example:
function waitForPopupMenu()
{
var popup = burster.WaitWindow("#32768", 10000);
if (false == popup.Exists) {
Log.Warning("The popup menu window has not appeared in 10 seconds.");
}
}
Please note that this solution can work only if the popup menu appears slowly indeed. How long it takes for the menu to be opened after a right-click is performed?
Dmitry Nikolaev
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
