예제 #1
0
        /// <summary>
        ///     Select item contained inside ComboBox by clicking on it with the cursor
        /// </summary>
        /// <param name="itemText">Item text</param>
        /// <param name="shouldVerify">Indicate whether or not to verify</param>
        public void ClickItemWithText(string itemText, bool shouldVerify = false)
        {
            ReportActionValue("ClickItemWithName", itemText);

            var listItemFound = FindItemWithText(itemText);

            listItemFound.Click();

            if (shouldVerify)
            {
                var friendlyMessage = ConstructFriendlyMessage(Resources.FriendlyComboBoxSelectMsg, itemText);
                QAAssert.IsTrue(QAListItem.GetParent(listItemFound, string.Empty).IsSelected, friendlyMessage);
            }
        }
예제 #2
0
        public ListItem FindItemWithText(string itemText)
        {
            ListItem listItemFound = null;

            var items = UIItem.Items;

            foreach (var listItem in items)
            {
                if (listItem.Text.Equals(itemText))
                {
                    listItemFound = listItem;
                    break;
                }
            }

            if (listItemFound == null)
            {
                foreach (var listItem in items)
                {
                    var label = QALabel.Get(SearchCriteria.All, string.Empty, listItem, 2);

                    if (label.UIItem != null)
                    {
                        if (label.Text.Equals(itemText))
                        {
                            listItemFound = listItem;
                            break;
                        }
                    }
                }
            }

            if (listItemFound == null)
            {
                Click();
                listItemFound = QAListItem.Get(SearchCriteria.ByText(itemText), string.Empty).UIItem;
            }

            return(listItemFound);
        }