Esempio n. 1
0
        /// <summary>
        /// Enters the users email.
        /// </summary>
        /// <param name="email"></param>
        /// <returns></returns>
        public virtual ILoginPage EnterEmail(string email)
        {
            EmailInputElement.Clear();
            EmailInputElement.SendKeys(email);

            return(this);
        }
Esempio n. 2
0
        internal static HtmlElement CreateFor(XElement element)
        {
            HtmlElement result = null;

            switch (element.Name.LocalName.ToLower())
            {
            case "form":
                result = new FormElement(element);
                break;

            case "input":
                string type = element.GetAttribute("type") ?? "";
                switch (type.ToLower())
                {
                case "radio":
                    result = new RadioInputElement(element);
                    break;

                case "checkbox":
                    result = new CheckboxInputElement(element);
                    break;

                case "image":
                    result = new ImageInputElement(element);
                    break;

                case "submit":
                case "button":
                    result = new ButtonInputElement(element);
                    break;

                case "file":
                    result = new FileUploadElement(element);
                    break;

                case "email":
                    result = new EmailInputElement(element);
                    break;

                case "url":
                    result = new UrlInputElement(element);
                    break;

                case "datetime-local":
                case "date":
                case "month":
                case "week":
                case "time":
                    result = new DateTimeInputElement(element);
                    break;

                case "number":
                case "range":
                    result = new NumberInputElement(element);
                    break;

                case "color":
                    result = new ColorInputElement(element);
                    break;

                default:
                    result = new InputElement(element);
                    break;
                }
                break;

            case "textarea":
                result = new TextAreaElement(element);
                break;

            case "select":
                result = new SelectElement(element);
                break;

            case "option":
                result = new OptionElement(element);
                break;

            case "iframe":
            case "frame":
                var src = element.GetAttributeCI("src");
                if (!string.IsNullOrWhiteSpace(src))
                {
                    result = new FrameElement(element);
                }
                else
                {
                    result = default(HtmlElement);
                }
                break;

            case "a":
                result = new AnchorElement(element);
                break;

            case "label":
                result = new LabelElement(element);
                break;

            case "button":
                result = new ButtonInputElement(element);
                break;

            default:
                result = new HtmlElement(element);
                break;
            }
            return(result);
        }