Posted: 22 Aug 2018 2:07 EDT Last activity: 27 Aug 2018 10:40 EDT
Save as click on the download bar is throwing Null Refrence exception
I have used @jeffbadger code to interrogate download bar and it was working fine with my win 10 machine and the customer win 7 machines . when the customer upgrade to win 10 , it stops working and gives me null reference exception when trying get the split button :
AutomationElement splitButton = aeDownloadToolBar.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.NameProperty, ""));
On my machine, the name in Windows 10 for that control changed from "" to "6". I am not sure if 6 is a constant or anything, so I decided to avoid it. The split button is a child of the save button, so I modified the code to find that first and then look for the split button as a child.
***You can use the "Inspect Objects" tool from the Windows SDK to identify the properties of specific elements.
I have tried your suggestion and it starting to give null reference exception when try to get split button , which means it didn't find Save button which is weird and I used inspect tool and the Save button is the same name .