c# - Interact with MessageDialog using Coded UI on Windows Phone -
i'm writing coded ui tests simple application , cannot seem code find or interact messagedialog box. using test builder able see box, , associated controls, in test unable find elements in app.
i think issue xamlwindow being used searching limited app under test, , popup exists outside context. have tried instantiate new xamlwindow context popup exists in, code unable find window except app of hardware buttons.
i have seen referenced in few other places messagedialog can found when using uimap, hand coding these tests , trying avoid use when possible. not against using uimap if there way generate in code , load messagedialog if possible.
after working automatically generated code able figure out answer. in order access messagedialog need instantiate uitestcontrol referencing popup window. issue comes because window outside of scope of app being tested. able instantiate uitestcontrol object of window using following:
uitestcontrol popupwindow = new uitestcontrol(); popupwindow.technologyname = "uia"; popupwindow.searchproperties[uitestcontrol.propertynames.controltype] = "window"; popupwindow.searchproperties["frameworkid"] = "uix";
the inportant difference between , normal instantiation of uitestcontrol object nothing passed new. allows code attach object outside of scope of tested app. here getting element in popup same on normal page, instead of passing testapp xamlwindow object pass popupwindow object.
Comments
Post a Comment