Quantcast
Channel: Windows Desktop Development for Accessibility and Automation forum
Viewing all articles
Browse latest Browse all 585

Need to click the hyperlink which in located in Datagrid cell using UI automation

$
0
0

Hi all,

Am working on UI automation. I can able to get the datagrid control in UI automation but I couldn't able to get the hyperlink control which is presented in all the rows in 2nd column. Kindly help me on this.

My code:

if (automationelementTSDwindow == null)
            {
                Condition condition = new PropertyCondition(AutomationElement.AutomationIdProperty, "TesterSummaryDisplayWindow");
                automationelementTSDwindow = AutomationElement.RootElement.FindFirst(TreeScope.Descendants, condition);
            }

            GridPattern gridControl;
            int integerElementPosition = -1;
            long rows;
            long columns;
            string[,] returnArray = null;
            ValuePattern dataItemControl;
            bool returnValue = false;
            bool direction = false;
            if (findAllElementsOfAType(ref automationelementarrayGridCollection, ControlType.DataGrid, automationelementTSDwindow))
            {
                integerElementPosition = getPositionInArrayBasedOnAutomationID(automationelementarrayGridCollection, automationID);
                gridControl = automationelementarrayGridCollection[integerElementPosition].GetCurrentPattern(GridPattern.Pattern) as GridPattern;
                rows = gridControl.Current.RowCount;
                columns = gridControl.Current.ColumnCount;
                string[,] dataArray = new string[rows, columns];
                string temp;
                scrollVerticalReset();
                scrollHorizontalReset();
                do
                {
                    direction = !direction;
                    do
                    {
                        //System.Threading.Thread.Sleep(100);
                        for (int i = 0; i < rows; i++)
                        {
                            for (int j = 0; j < columns; j++)
                            {
                                try
                                {
                                    if (dataArray[i, j] == null)
                                    {
                                        dataItemControl = gridControl.GetItem(i, j).GetCurrentPattern(ValuePattern.Pattern) as ValuePattern;
                                        temp = dataItemControl.Current.Value;
                                        if (temp != null && temp != string.Empty)
                                        {
                                            dataArray[i, j] = temp;
                                        }
                                        temp = null;
                                    }
                                }
                                catch
                                {
                                    dataArray[i, j] = null;
                                }
                            }

                        }
                    } while (!(scrollVerticalIncrament(direction)));
                } while (!(scrollHorizontalIncrament()));

                returnArray = dataArray;
            }

Thanks in Advance!!!


Viewing all articles
Browse latest Browse all 585

Trending Articles



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