How to access inner elements of a WPF custom control that doesn't implement the AutomationPeer class? -


recently came know article -

http://blogs.msdn.com/b/patrickdanino/archive/2009/11/11/custom-controls-and-ui-automation.aspx

-that controls in wpf responsible exposing uia items themselves, , newly added functionalities of custom control aren’t available uia until exposed through implementation of corresponding automationpeer class. @ work have been assigned automation of ui testing of wpf application employs large number of toolbars. problem is, through microsoft ui automation library can access toolbars (apparently developed custom control) automationelements, cannot access buttons inside them – count of children/descendant collection return 0. when using coded ui test, tests fail , shows following error message:

test method cam2qdummytest.codeduitest2.codeduitestmethod1 threw exception:

microsoft.visualstudio.testtools.uitest.extension.failedtoperformactiononblockedcontrolexception: control blocking control. please make blocked control visible , retry action. additional details:

technologyname: 'msaa'

name: 'standard'

controltype: 'toolbar'

---> system.runtime.interopservices.comexception: exception hresult: 0xf004f003

apparently didn’t implement corresponding automationpeer classes. now, have application, not source code. cannot solve problem in way described in article mentioned above. can clue how can access inner buttons of toolbars? suggestion gratefully appreciated.

you can have @ patterns , properties are supported via automationelement.getsupportedproperties() , automationelement.getsupportedpatterns() see if there's different pattern can use. might there list elements, etc. via selectionpattern or similar give access buttons.

otherwise, in touch vendors , ask them add relevant peers.

you can coordinates (maybe boundingrectangleproperty) use win32 functions simulate mouse click in appropriate place. nasty. this thread might help.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -