Question

1
Replies
119
Views
SuryaTejaK Member since 2017 3 posts
Accenture
Posted: 2 years ago
Last activity: 2 years 2 months ago
Closed

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);

/* 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;

}

----------------------------------------

Robotic Process Automation
Moderation Team has archived post
Share this page LinkedIn