Quantcast
Channel: Windows Desktop Development for Accessibility and Automation forum
Viewing all 585 articles
Browse latest View live

User Objects leak in UIAutomation native client if UIAutomation server application is closed.

$
0
0

VS 2015. Native C++ development. UIAutomation client issue.

If your client application get IUIAutomationElement usingElementFromHandle and server application closed before your app released the element, User Object leak occur. Further call of theRelease() seems to have zero effect.

Below you can find a complete source code that reproduces the problem.

Run the code below and then run and close calc.exe several times, you will see the number of opened User Objects raises each time you run new instance of the calc.exe.

Am I doing something wrong or this is a UIAutomation problem?

#include <Windows.h>
#include <UIAutomation.h>

DWORD WINAPI ScanThreadProc(LPVOID lpParameter)
{
	MSG msg;
	PeekMessage(&msg, NULL, NULL, NULL, PM_NOREMOVE);

	CoInitializeEx(NULL, COINIT_MULTITHREADED);
	IUIAutomation *g_pAutomation = NULL;
	HRESULT	hResult = CoCreateInstance(__uuidof(CUIAutomation), NULL, CLSCTX_INPROC_SERVER, __uuidof(IUIAutomation), (void**)&g_pAutomation);
	IUIAutomationElement *calc_ui = NULL;
	HWND CalcUIHWND = NULL;
	while (true)
	{
		while (PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE))
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		};

		Sleep(1);

		CalcUIHWND = FindWindow(L"CalcFrame", NULL);
		if (CalcUIHWND == NULL)	continue;

		hResult = g_pAutomation->ElementFromHandle(CalcUIHWND, &calc_ui);
		if (FAILED(hResult))
		{
			if (calc_ui != NULL)
			{
				calc_ui->Release();
				calc_ui = NULL;
			}
			continue;
		}

		if (calc_ui != NULL)
		{
			Sleep(1000);
			calc_ui->Release();
			calc_ui = NULL;
		}
	}
	return 0;
}

int CALLBACK WinMain(
	_In_ HINSTANCE hInstance,
	_In_ HINSTANCE hPrevInstance,
	_In_ LPSTR     lpCmdLine,
	_In_ int       nCmdShow
	)
{
	WaitForSingleObject(CreateThread(NULL, 0, ScanThreadProc, 0, 0, 0), INFINITE);

	return 0;
}



Odd context menu behavior

$
0
0

Hi all,

I've been doing some work involving UIA and context menus, and I've noticed some odd behavior... I'm wondering if this is normal/expected?

When using UIA to observe the UI on Windows Server 2008 R2 I see the following behavior:

- I right-click on the desktop, bringing up a context menu
- I hover on another sub-menu, causing it to appear next to the context menu

At this point I have the following UI hierarchy:

[root element] -> [context menu]

[root element] -> [program manager] -> [sub-context menu]

This seems very odd... is it expected? Or am I perhaps doing something wrong?

Thanks for your time,

Alex

Magnify.exe causes mouse cursor to disappear in some games

$
0
0

Because I could not locate a forum in the given list that made sense, i'm going to try this one.

I'm a legally blind user that like to play games on my windows pc's (windows 7 and 10). The problem is, I rely heavily on Windows Magnifier (Magnify.exe) to make in-game chat and other text visible, but for games that are Full-screen, this causes the mouse cursor to disappear behind the program... clicking still works, but without being able to see the mouse cursor on the screen, Magnify.exe become useless. Also, in these circumstances, the games going into full-screen mode typically causes the screen to zoom back out all the way, displaying the entire screen, and zooming back in does not work.

The irony here is that for games like World of Warcraft, Diablo 3, and League of Legends, the developers clearly state that if users experience a problem where their mouse cursors disappear, they should disable or close Magnify.exe in the Windows Accessibility settings. The reason this is ironic, is because if you are a user that needs windows magnifier to read text on your screen, this "work around" for normally sighted users works great for them, but essentially gives a giant middle finger to us (legally blind users).

My question, and the reason I am posting this in the MSDN forums, is:

1. Is there a known way for heavily graphic-intensive games to make use of full screen mode in a way that is compatible with Magnify.exe?

2. Is there some code in whatever languages these types of games (listed above) are developed in that I could provide to game developers as a basis for them to make their games accessibility-friendly?

I would really appreciate any helpful info or insights on this. Thank you in advance :)

Help with Windows update: Error 1719

$
0
0

After updating from W7 to <g class="gr_ gr_11 gr-alert gr_gramm Punctuation only-ins replaceWithoutSep" data-gr-id="11" id="11">W10</g> I have got a problem with Windows Installer Service.  When I try to update Windows or a program I get this error:

Error 1719: The Windows Installer Service could not be <g class="gr_ gr_199 gr-alert gr_spell ContextualSpelling ins-del multiReplace" data-gr-id="199" id="199">accassed</g>.  and

trying to reinstall W 10 gives this fault:

"Page fault in <g class="gr_ gr_316 gr-alert gr_spell ContextualSpelling ins-del multiReplace" data-gr-id="316" id="316">non</g> paged area (<g class="gr_ gr_317 gr-alert gr_spell ContextualSpelling ins-del multiReplace" data-gr-id="317" id="317">cmdhlp</g>.sys)"

How can I solve this???

Hope someone can help me.

Regards

kuch01

How to get name / value from custom control like the Inspect tool does from Microsoft?

$
0
0

Does anybody know how to get the name/value of an AutomationElement of custom control type? Please see the image with the link below. I am interested in getting the name/value of the highlighted AutomationElement that Inspect tool by Microsoft is able to get. I tried checking if the AutomationElement supports IAccessible since from the Inspect tool since IsLegacyIAccessiblePatternAvailableProperty is true. I didn't have much luck with the following snippet of codes and all I got was empty string for all children of the AutomationElement of table Control (the parent of the highlighted AutomationElement in the image). Please advise.

AutomationElement sibling = TreeWalker.RawViewWalker.GetFirstChild(table);

            while (sibling != null)
            {

                if ((Boolean)sibling.GetCurrentPropertyValue(AutomationElementIdentifiers.IsLegacyIAccessiblePatternAvailableProperty))
                {
                    var pattern = ((LegacyIAccessiblePattern)sibling.GetCurrentPattern(LegacyIAccessiblePattern.Pattern));
                    var name = pattern.GetIAccessible().accValue;

                    //allChildren.Add(sibling);
                    if (((string)name).IndexOf(deviceId) != -1)
                    {
                        AutomationElement device = TreeWalker.RawViewWalker.GetPreviousSibling(sibling);

                        if (device != null)
                        {
                            checkBox = TreeWalker.RawViewWalker.GetPreviousSibling(device);
                            break;
                        }
                    }
                }

                sibling = TreeWalker.RawViewWalker.GetNextSibling(sibling);
            }

Accessing a CMFCToolBarButton for UI Automation

$
0
0

Hi wise guys and ladies, I've been playing, reading, and researching for a week and my boss wants so see progress, so I decided to ask in this forum. My task is to make an application fit for coded UI tests which has been under continued development for 10 years or so, and contains tons of legacy C++ code so that rewriting is not an option. The first simple (or so I thought) test is: load data into the application, read out the GUI which displays some basic information about the loaded data, and verify that what we read is what we expect.

It was easy to load the data, but I cannot read the data from the GUI. The information which I need is displayed in a button in a button bar. The button class is derived from CMFCToolBarButton. In the coded UI test project, I can pick "Generated Code for Coded UI Test" from the "Test" menu and then click "Coded UI Test Builder". Then I drag the target icon to the toolbar button in question. The button is then displayed with a blue rectangle around it, and I see some of its data in a pop-up window of the Test Builder. Unfortunately, the text which the button displays is in the "Name" field, and the "DisplayText" field contains the name of the toolbar.

I then overwrote the SetACCData methods of the button class, setting the m_strAccName, m_strAccValue, and m_strDescription members of the CAccessibilityData parameter to what should be useful strings. Now the Test Builder displays a useful button name but the DisplayText is still empty. From long debugging sessions I found out that no call is ever issued that reads the m_strAccValue field.

Any ideas on reading the value of an MFC toolbar button? Or am I missing something fundamental? Thanks a lot...


Update: I found a solution which I am posting as a reply to my question.

AutomationElement.FindAll() performance issue

$
0
0

Hello,

We have been working with the MS UIA framework and noticed what appears to be a significant slowdown when finding collections of objects in Windows 10 / .NET 4.6.

When testing AutomationElement.FindAll() on a Windows 10 / .NET 4.6 box our times on average are roughly 3 to 5 times longer to find collections of elements than when finding the exact same elements on a Windows 8.1 / .NET 4.5.1 box.

My test is against a WPF DataGrid with virtualization on (using Recycling) and getting all of the cells inside each row of the DataGrid.  On our Win10 box each FindAll call to get the cells in each row takes roughly 30 - 50ms or even longer.  On the Win8.1 box it takes around 5 - 10ms.  I am unable to figure out why, but I do not think the issue is limited to the DataGrid since there is nothing fancy about our FindAll() call.

//get grid
            AutomationElement gridElement = AutomationElement.RootElement.FindFirst(TreeScope.Descendants,
                new PropertyCondition(AutomationElement.AutomationIdProperty, "dataGridAutomationId"));

            //get all visible rows
            AutomationElementCollection dataItems = gridElement.FindAll(TreeScope.Descendants,
               new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.DataItem));

            PropertyCondition condition = new PropertyCondition(AutomationElement.ClassNameProperty, "DataGridCell");

            foreach (AutomationElement dataItem in dataItems)
            {
                if (!string.IsNullOrEmpty(dataItem.Current.Name))
                {
                    //call under test
                    AutomationElementCollection cells = dataItem.FindAll(TreeScope.Children,
                        new PropertyCondition(AutomationElement.ClassNameProperty, "DataGridCell"));
                }
            }

The use of AutomationElement.RootElement is for the test only.  The 'dataItem.FindAll()' call is what I am testing.

Win 8.1 and Win10 machine specs:

 - Xeon W3670 3.20GHz cpu

 - 12gb ram

 - 64bit OS

We have tried using the unmanaged API via com wrapping and saw no noticeable performance improvements on Win10.

If this question should be on another forum or somewhere else or more information is needed please let me know.  

Thank you,
Jordan


ServerProvider cause ClientProvider does not work

$
0
0

Hi Experts,

When i use unmanaged uia such as running the following step:

IUIAutomation _automation2;
_automation2 = new CUIAutomation();
IntPtr hwnd2 = Win32.FindWindow(strBrowserWindowClass, null);
IUIAutomationElement element2 = _automation2.ElementFromHandle(hwnd2);
IUIAutomationCondition conditionHyperlink = _automation.CreatePropertyCondition(_propertyIdControlType, 50007);
IUIAutomationCondition conditionName = _automation.CreatePropertyCondition(30005, "Reports");
IUIAutomationCondition conditionA = _automation.CreateAndCondition(conditionHyperlink, conditionName);
elementArray2 = element2.FindAll(TreeScope.TreeScope_Descendants, conditionA);

I can get the element i want.

But if i add one managed uia step before element2.FindAll :

AutomationElement e= AutomationElement.RootElement;

(with UIAutomantionClient and UIAutomantionType added in reference, and using System.Windows.Automation;)

I failed to find the element i want.

I just want to add unmanaged uia support in our existing managed uia project.


It is probably due to the Client Provider is affected by Server Provider

Found in http://www.programdevelop.com/2604422/ that : 

If a UI Server to have both ServerProvider and ClientProvider ServerProvider overwrite same type ClientProvider. If any Provider only in ClientSide to achieve ClientProvidier the right to return. Do not have to worry about the the ServerProvider cause ClientProvider does not work

I notice that the element.CurrentProviderDescription changed from unmanaged to managed , from uiautomationcore.dll to uiautomationclient

and i may get exception : 

Message: A QueryInterface call was made requesting the class interface of COM visible managed class 'MS.Internal.AutomationProxies.WindowsEditBox'. However since this class derives from non COM visible class 'MS.Internal.AutomationProxies.ProxyHwnd', the QueryInterface call will fail. This is done to prevent the non COM visible base class from being constrained by the COM versioning rules.


Can i reset the Provider back to unmanaged one?

I am stuck by the influence of "AutomationElement.RootElement" now

Thanks




ToolStripTextBox not automated

$
0
0

I have problem when trying to get the uiautomation information from a ToolStrip.

I have created a simple example in VisualStudio 2008. It is a WinForms application with only one Form.

That form only contains a ToolStrip. I get the correct uiautomation information for the toolstrip as long as it does not contain ToolStripTextBox or ToolStripComboBox items. All items to the left of the first ToolStripTextBox/ToolStripComboBox is automated correct but from items of TextBox or ComboBox types the information is currupt. Most items to the right of the first TextBox/ComboBox are not even visisible in the uinformation.

What is wrong with those two components?

I get the same result in different UIVerify tools as well as when using the White framework.

I have tested both on Windows XP and Windows 7.

I attach a link to a thread in the White forum on Codeplex where I have asked the same question without getting any answer that solves my problem: http://white.codeplex.com/Thread/View.aspx?ThreadId=231270&ANCHOR#Post516883

 

/Erik

Is it possible to automate Hybrid windows desktop app using MS UI Automation framework

$
0
0

Need to write GUI automation test cases for a windows desktop hybrid application, view is written in HTML rather than XAML. Can Microsoft UI Automation framework can be used for that.

We have tried with Coded UI but it only supports XAML based app.

ToolStripTextBox, ToolStripComboBox not automated

$
0
0

In UI Automation, when automating the toolstrip items we are facing an issue which is described below

I am adding toolstrip items as follows

this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.toolStripButton1,
            this.toolStripButton2,
            this.toolStripComboBox1,
            this.toolStripButton3});

When running the UI Automation(System.Windows.Automation), UI automation finds the controls till toolStripButton2 (i.e) controls on the left side of toolstripcombobox is getting recognized but on the controls on the right side.(If i make the combobox to go the right most control everything works fine)

Note: In Inspect.exe tool from windows kits, all the controls are shown but when trying to access the last toolStripButton3 returns null.

Here i have attached the simplified code, the buttonCollection is expected to get 3 buttons but it gets only two in my case.

AutomationElement toolstrip = viewTab.FindFirst(TreeScope.Children,
            new PropertyCondition(AutomationElement.AutomationIdProperty, "toolStrip1"));

        AutomationElementCollection buttonCollection = toolstrip.FindAll(TreeScope.Children,
            new PropertyCondition(AutomationElement.LocalizedControlTypeProperty, "button"));

Both ToolStripTextBox and ToolStripComboBox are showing the same behavior.

I would like know what is going wrong in my approach.

Thanks,

Kesavan

UI Automation Element From Point freezes Internet Explorer and Inspect tool

$
0
0

Hi,

We have a C++ application that uses UI Automation to collect accessibility information of  element at current mouse position (it's very similar to Inspect tool). Our application looks like this:

IUIAutomation* CIUIAutomationProvider::GetUIAutomation() { if (m_pIUIAutomation == NULL) { CoCreateInstance(__uuidof(CUIAutomation), NULL, CLSCTX_INPROC_SERVER, __uuidof(IUIAutomation), (void**)&m_pIUIAutomation); } return m_pIUIAutomation; } SPUIAutomationElement CIUIAutomation::GetCIUIAutomationFromPoint(POINT pt) { IUIAutomation* pUia = CIUIAutomationProvider::GetUIAutomation(); SPUIAutomationElement spUiaElement; if (pUia != NULL) { if (pUia->ElementFromPoint(pt, &spUiaElement) == S_OK&& spUiaElement != NULL) {//spUiaElement->get_CurrentName();

return spUiaElement;

}} }

However, the call pUia->ElementFromPoint(pt, &spUiaElement) freezes out application and the target application. Target application is the webpage www.netsuite.com, viewed by Internet Explorer 11.

After IE and Inspect are hung, we use Spy++ (a tool shipped with Visual Studio) to view the structure of IE, and we saw that IE created a new window named "FrameTab Cover".

The "FrameTab Cover" window is not exist if the IE is not hung. So my questions are:

1. What is the purpose of "FrameTab Cover" window? Why it is created?

2. We think that the creation of "FrameTab Cover" window happens while UI Automation is on the progress of collecting element from point, it changes the UI Automation tree, and it blocks the function. If that is true, can we prevent the creation of "FrameTab Cover" window? And how?

We're using Windows 7 Enterprise SP1 64-bit and IE 11.

Thanks,

Quan.

UIAutomation Click using Invoke Pattern of AutomationElement

$
0
0

I want to click on a tab which has invoke pattern only. I am getting the invoke pattern of the AutomationElement and Invoke() method is also getting executed but click is not happening on the tab of the application. Here is my code snippet :

 foreach (AutomationElement AE in serviceRequestTab)
                {
                    if (AE.Current.Name == "Notes")
                    {
                        InvokePattern ptrnServiceRequestTab = AE.GetCurrentPattern(InvokePattern.Pattern) as InvokePattern;
                        //System.Windows.Point pt= AE.GetClickablePoint();
                        if (ptrnServiceRequestTab != null)
                        {
                            ptrnServiceRequestTab.Invoke();
                            Thread.Sleep(4000);
                        }
                    }
                }

Besides using GetClickalblePoint() method throws exception : "Element doesn't have any clickable point".

Anyone who can help me out?

UIAutomation FindFirst Method is not working after upgrading 4.5.2 framework.Below is the code we are using

$
0
0

 Hello,

         We are using below method to find sub tree items. Able to find Main node but it is showing zero children in it. By using inspect tool Main node is showing like group and sub tree also able to see. We used name property to get sub child elements but tried using element collection also. It is also returning only main nodes. It happened after we upgrade our framework to 4.5.2.  

public static AutomationElement GetElementByNameFromDescendants(AutomationElement parentElement, string value)
        {
            return Utility.TryGetElement(() =>
            {
                return parentElement.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.NameProperty, value));
            }, 10, 1000);
        }

To get element collection:

 public static AutomationElement GetElementByPartialNameFromDescendants(AutomationElement element, string value)
        {
            AutomationElementCollection elementCollection =
             element.FindAll(TreeScope.Descendants, Condition.TrueCondition);
            int count = elementCollection.Count;
            for (int i = 0; i <= count - 1; i++)
            {
                if (elementCollection[i].Current.Name != null)
                {
                    if (elementCollection[i].Current.Name.IndexOf(value) >= 0)
                    {
                        return elementCollection[i];
                    }
                }
            }
            return null;
        }


Problem on Clicking on radio button using UI automation

$
0
0

Is there a property to click on a radio button using UIautomation

The problem is selecting the on the radio button i am unable to see the further actions that is performed , as the client is performing

i am using this code to detect the radio button and selecting it:

AutomationElement AlignmentradioButtonPASS = GetTextElement(appElement1, "rdBtnPass");

                            

if (AlignmentradioButtonPASS != null)
                        {
                            xmlWriter.WriteElementString("PASS_Contrast_Pattern", "Tests");
                            xmlWriter.WriteString("Click on Contrast Pattern Button and PASS Radio Button");
                            SelectionItemPattern AlignradioCheckPass = AlignmentradioButtonPASS.GetCurrentPattern(SelectionItemPattern.Pattern) as SelectionItemPattern;

                            AlignradioCheckPass.Select();

.....

}

In my client application the moment i click on the radio button that particular grid is getting highlighed, but in my script on select it is not getting highlighted

Any suggestions or solutions please help 


product key

$
0
0

plis give activation product key my ID is 54214252268384249276872412. thks

email yudhisintan@outlook.com

VisualUIAVerifyNative.exe finds a different BoundingRectangle than searching for several SWT Controls.

$
0
0

I have an SWT application with tabitems.

VisualUIAVerifyNative.exe highlights each TabItem correctly.

When I search for the tabitems using FindFirst method or Teststack.White I get a different bounding rectangle (the coordinates are wrong).

I am pretty sure both methods find the same TabItem. The same happens with HeaderItems.

If I do the same with Buttons, ComboBoxes both ways of getting the bounding rectangle show the same coordinates.

I am using Window 10.

What could I do to fix this problem?

UI Automation for Delphi application

$
0
0

Hi,

I have been tasked with writing automated tests for a huge legacy application written in Delphi.  I have looked at using UI Automation from a mstest or nunit harness(C#), but have come across a major stumbling block.  When I use UI Spy to look at the delphi application, the Automation ID returned from every control is a arbitrary number. It changes every time the application is launched. 

 

I have been looking at the documentation on MSDN, and I am guessing that this can be rectified by implementing a custom provider.  Any pointers as to how this can be accomplished in Delphi?  We have full access to the source code for the Delphi application.

 

Thanks,

Erling

Some pattern's methods of the desktop shortcut icons return unexpected errors(+)

$
0
0

For instance the Invoke.Invoke() method returns UIA_E_ELEMENTNOTAVAILABLE error, ScrollItem.ScrollIntoView() method returnsCOR_E_INVALIDOPERATION error. Some methods like SelectionItem.Select() work as expected.

It can be reproduced using Inspect Object.exe (Windows 7 Professional 64).

Any ideas? Thanks.


how to enable microsoft edge accessibility

$
0
0

I see that microsoft edge supported accessibility technology as narrator. It can access and read controls on window 10. I try and see that it works normally. However, AccExplore32 tool can not access web element in Edge although it still works with IE.

I use accessibility technology like AccTool. Therefore, I can not access web elements in Edge page.

Chrome has a setting that force chrome enable accessiblity by "--force-renderer-accessibility"

How can I do as narrator ?

Viewing all 585 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>