Question
Accenture
IN
Last activity: 6 Nov 2018 20:02 EST
SaveAs click on the download notification bar is throwing Unsupported pattern in script
I'm trying to click on Save As button on the download notification bar . My Script is throwing "Unsupported Pattern" error
--------------------------------------------------
if(handle != IntPtr.Zero)
{
AutomationElement aeDownloadToolBar = AutomationElement.FromHandle(handle);
AutomationElement rootElement = AutomationElement.RootElement;
if (aeDownloadToolBar != null)
{
AutomationElement splitButton = aeDownloadToolBar.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.NameProperty, ""));
InvokePattern ipClickButton1 = (InvokePattern)splitButton.GetCurrentPattern(InvokePattern.Pattern);
I'm trying to click on Save As button on the download notification bar . My Script is throwing "Unsupported Pattern" error
--------------------------------------------------
if(handle != IntPtr.Zero)
{
AutomationElement aeDownloadToolBar = AutomationElement.FromHandle(handle);
AutomationElement rootElement = AutomationElement.RootElement;
if (aeDownloadToolBar != null)
{
AutomationElement splitButton = aeDownloadToolBar.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.NameProperty, ""));
InvokePattern ipClickButton1 = (InvokePattern)splitButton.GetCurrentPattern(InvokePattern.Pattern);
/* Exception is throwing after this particular line */
System.Threading.Thread.Sleep(3000);
ipClickButton1.Invoke();
System.Threading.Thread.Sleep(3000);
PropertyCondition condition2 = new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Menu);
AutomationElement contextMenu = rootElement.FindFirst(TreeScope.Children, condition2);
AutomationElement saveAsButton = contextMenu.FindFirst(TreeScope.Children, new PropertyCondition(AutomationElement.NameProperty, "Save as"));
InvokePattern ipClickButton2 = (InvokePattern)saveAsButton.GetCurrentPattern(InvokePattern.Pattern);
System.Threading.Thread.Sleep(3000);
ipClickButton2.Invoke();
result = true;
}
----------------------------------------