Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

WPF element is OffScreen Error

$
0
0

I am currently working on UI automation using White Framework..I have a ListView consisting of multipple rows.

Now when i try to select the rows using their index I am able to select the one at index 0 but not the other rows.

Each row actually contains a button that I need to click. So when the execution comes to button.Click() for some row other than the one at index 0 it throws an exception as WPF element offscreen. How do i resolve this error..

Here is the code for that  I am using..

var datagrid = BonusAppControllers.EbsControl.GetCurrentWindow().GetModalWindowByAutomationId(_modalWindowName).GetByAutomationId<ListView>("lvUnassignedList");
            datagrid.Select(index);
            AutomationElement element = datagrid.Rows[index].AutomationElement.FindFirst(TreeScope.Descendants, SearchConditionFactory.CreateForAutomationId("btnListAdd").AutomationCondition);
            Console.WriteLine(datagrid.Rows[index].IsSelected);
            Button btn = new Button(element, datagrid.ActionListener);
            btn.Click();


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>