Cannot find WinForm Form Dialog triggered from Word Add-In
See original GitHub issueHello,
I’m using WinAppDriver driven by Appium, trying to test a Word Add-In WinForms application, currently running into an issue trying to locate a dialog that appears.
The issue: We have a Microsoft Word COM Add-In that has a button on it that we use to open up a Form Dialog (calling xxx.ShowDialog(this)
. We have been using the both sessions and the wordElement callingxxxSession.FindByName
, xxxSession.FindByAccessibilityId
, xxxSession.FindByXpath, and xxxSession.FindByClass
but still cannot find it.
I have opened up Inspect.exe and can hover over the dialog and it will bring show properties of the Dialog (confirming the Name and AutomationId and other values like Children controls and it’s Ancestors), it does not show where it this element exists in the TreeView view of Inspect.exe which is on the left hand side.
Has anyone had this issue?
//This is how we are setting up the Sessions:
WindowsDriver<WindowsElement> driverWinWord;
WindowsDriver<WindowsElement> driverDesktop;
AppiumOptions optionsWinWord;
AppiumOptions optionsDesktop;
optionsWinWord = new AppiumOptions();
optionsWinWord.AddAdditionalCapability("app", "winword");
optionsWinWord.AddAdditionalCapability("appArguments", fileName);
optionsWinWord.AddAdditionalCapability("ms:waitForAppLaunch", "6");
driverWinWord = new WindowsDriver<WindowsElement>(new Uri(url), optionsWinWord);
optionsDesktop = new AppiumOptions();
optionsDesktop.AddAdditionalCapability("app", "Root");
driverDesktop = new WindowsDriver<WindowsElement>(new Uri(url), optionsDesktop);
var wordElement = driverWinWord.FindElementByClassName("OpusApp");
We have tried calling FindXXX
within retry logic and tried using Appiums WebDriverWait technique in case it needed more time to find the element.
I have also looked at the PageSource of both of our sessions and cannot see the dialog in the XML, so I am pretty confident it isn’t a timing issue, just that WAD cannot see it (even though Inspect.exe sees it, but just doesn’t know where it is with regards to the rest of the controls on the desktop).
Any advice?
Let me know if you need some more information.
Issue Analytics
- State:
- Created 2 years ago
- Comments:22
Top GitHub Comments
It do not particularly like using Inspect or Accessibility Insights. Sometime it is necessarily to get the actual XML time synchronous with the execution of the testing code. (ie what Inspect see and what your test code sees may be different)
You can dump the session XML using
Ah yes @DLightstone we have since moved away from trying to find it by name and do so via FindByClass() as well. Thank you again I have learnt a fair bit during this invetigation proces aswell!!