Highlighted
Trusted Contributor.
Trusted Contributor.
1929 views

Lean ft c# context menu

How can I capture a context menu o a standard windows form with lean ft c#?

UFT code is the following:

Dialog("App Name").WinObject("Object Name").WinMenu("ContextMenu").Select "Select Menu..."

I'm not able to capture it with Object Identification Center.

UFT version 12.54 editor Visual Studio 2015.

Thanks.

0 Likes
11 Replies
Highlighted
Trusted Contributor.
Trusted Contributor.

Re: Lean ft c# context menu

no one?

0 Likes
Highlighted
New Member.

Re: Lean ft c# context menu

Try the following:

var menu = window.Describe<IMenu>(new MenuDescription
{
    Type = HP.LFT.SDK.StdWin.MenuType.ContextMenu
});
menu.Select(menu.BuildMenuPath("Select Menu..."));

where the window variable represents the window you are trying to display the context menu on.

Hope it helps.

Highlighted
Trusted Contributor.
Trusted Contributor.

Re: Lean ft c# context menu

HI, 

Here is my code, but didn't worked: Please advise.

var window = Desktop.Describe<IWindow>(new WindowDescription
{
WindowClassRegExp = @"Afx:",
WindowTitleRegExp = @"Parent Window"
}).Describe<IDialog>(new DialogDescription
{
Text = @"Parent Window",
NativeClass = @"#32770"
});
window.Activate();
var obj = window.Describe<IUiObject>(new UiObjectDescription
{
Text = @"Object Name",
WindowClassRegExp = @"AfxWnd90u",
WindowId = 100,
NativeClass = @"AfxWnd90u"
});
//qw.Highlight();
obj.Click(MouseButton.Right);
var menu = window.Describe<HP.LFT.SDK.StdWin.IMenu>(new HP.LFT.SDK.StdWin.MenuDescription
{
Type = HP.LFT.SDK.StdWin.MenuType.ContextMenu
});
menu.Select(menu.BuildMenuPath("Status..."));

After right click on object I tried both types of menus : 

1. window.describe

2. obj.describe

No success.

Thank you!

0 Likes
Highlighted
Trusted Contributor.
Trusted Contributor.

Re: Lean ft c# context menu

someone can help me, please?

0 Likes
Highlighted
Trusted Contributor.
Trusted Contributor.

Re: Lean ft c# context menu

no one?

0 Likes
Highlighted
Trusted Contributor.
Trusted Contributor.

Re: Lean ft c# context menu

???????

0 Likes
Highlighted
Trusted Contributor.
Trusted Contributor.

Re: Lean ft c# context menu

Do you have a hpse mail address from support? Thanks.

0 Likes
Highlighted
Trusted Contributor.
Trusted Contributor.

Re: Lean ft c# context menu

Dialog("Kalignite SIM Central").WinObject("Card Reader").WinMenu("ContextMenu").Select "Status..."


c# VS 2015 not working method

public void TestRightClick()
{
var obj = Desktop.Describe<IWindow>(new WindowDescription
{
IsOwnedWindow = false,
IsChildWindow = false,
WindowClassRegExp = @"Afx:",
WindowTitleRegExp = @"Kalignite SIM Central"
}).Describe<IDialog>(new DialogDescription
{
IsOwnedWindow = true,
IsChildWindow = false,
Text = @"Kalignite SIM Central",
NativeClass = @"#32770"
}).Describe<IUiObject>(new UiObjectDescription
{
Text = @"Card Reader",
WindowClassRegExp = @"AfxWnd90u",
WindowId = 100,
NativeClass = @"AfxWnd90u"
});
obj.Click(MouseButton.Right);

var menu = obj.Describe<HP.LFT.SDK.StdWin.IMenu>(new HP.LFT.SDK.StdWin.MenuDescription
{
Type = HP.LFT.SDK.StdWin.MenuType.ContextMenu
});
menu.Select(menu.BuildMenuPath("Status..."));

}

 

The context menu is located on stdwin object.
I'm getting this exception:


An exception of type 'HP.LFT.SDK.ReplayObjectNotVisibleException' occurred in HP.LFT.SDK.dll but was not handled in user code

Additional information: Object not visible

Please help!

0 Likes
Highlighted
Trusted Contributor.
Trusted Contributor.

Re: Lean ft c# context menu

Any help?

0 Likes
Highlighted
Trusted Contributor.
Trusted Contributor.

Re: Lean ft c# context menu

0 Likes
Highlighted
Trusted Contributor.
Trusted Contributor.

Re: Lean ft c# context menu

Code examples are available in the main LeanFT Help. The SDK references do not include samples, only descriptions.

You can find .NET samples here: LeanFT .NET code samples

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.