Пример #1
0
 public bool Exists()
 {
     return(element.Exists());
 }
 public bool Exists(Options options = null)
 {
     return(Element.Exists(options));
 }
Пример #3
0
 public static void ShouldExist(this ElementScope element)
 {
     element.Exists().ShouldBeTrue();
 }
Пример #4
0
        public string FillFormField(HpgElement field, string fieldValue)
        {
            //HpgAssert.Exists(field, "Verify field '" + field.Element.Id + "' exists");
            string originalValue = "";
            string elementType   = field.Element["outerHTML"];

            elementType = elementType.Substring(1, elementType.IndexOf(' ')).Trim().ToLower();
            switch (elementType)
            {
            case "input":
                //Text, Check, or Radio
                switch (field.Element["type"].ToLower())
                {
                case "text":
                    //text box
                    originalValue = field.Text;
                    field.Type(fieldValue);
                    break;

                case "checkbox":
                    //check box
                    if (field.Element.Selected)
                    {
                        originalValue = "TRUE";
                    }
                    if (fieldValue.Trim().Equals(""))
                    {
                        field.Element.Click();
                        field.UnCheck();
                    }
                    else
                    {
                        field.Element.Click();
                        field.Check();
                    }
                    break;

                case "radio":
                    //radio button
                    ElementScope originalSelection = browser.FindXPath("//input[@name='" + field.Element.Id + "' and @checked='true']");
                    if (originalSelection.Exists())
                    {
                        originalValue = originalSelection.Value;
                    }
                    field.Element.Click();
                    browser.Choose(field.Element.Id);
                    break;
                }
                break;

            case "select":
                //Drop-Down
                originalValue = field.Element.SelectedOption;
                field.Click();
                field.Element.SendKeys(fieldValue);
                field.Element.FindXPath(".//*[.='" + fieldValue + "']").Click();
                browser.Select(fieldValue).From(field.Element.Id);
                break;

            case "textarea":
                //Large text area
                originalValue = field.Text;
                field.Type(fieldValue);
                break;
            }
            return(originalValue);
        }
Пример #5
0
 /// Being polled for DelayedElement to exist if ViewFactory#Load is called.
 public override bool IsLoaded()
 {
     return(DelayedElement.Exists());
 }