We need to add HTMLIFRame

Jun 18, 2013 at 7:31 AM
Edited Jun 18, 2013 at 7:44 AM
Team,

We need to add HTMLIFrame cuite control.

Even if i try to add this control exception is raised from wraputil 'HTMLIFRame not supported'


I added an elseif in wrap util now it works fine, but this should be added to cuite by default.

Any reason why we opted to not include iframe control?
Coordinator
Jun 26, 2013 at 1:22 AM
I created a feature request here.

I'll be happy to incorporate your changes to the CUITe source code if you want to share your code.

Thank you.
Jul 1, 2013 at 4:14 AM
Hi icnocop sorry for the delay

here is for iframe
using Microsoft.VisualStudio.TestTools.UITesting.HtmlControls;

namespace CUITe.Controls.HtmlControls
{
    public class CUITe_HtmlIFrame : CUITe_HtmlControl<HtmlIFrame>
    {
        public CUITe_HtmlIFrame() : base() { }
        public CUITe_HtmlIFrame(string searchParameters) : base(searchParameters) { }
    }
}
changes in wraputil in CUITe_HtmlControl.cs
        private ICUITe_ControlBase WrapUtil(HtmlControl control)
        {
            ICUITe_ControlBase _con = null;
            if (control.GetType() == typeof(HtmlButton))
            {
                _con = new CUITe_HtmlButton();
            }
            else if (control.GetType() == typeof(HtmlCheckBox))
            {
                _con = new CUITe_HtmlCheckBox();
            }
            else if (control.GetType() == typeof(HtmlComboBox))
            {
                _con = new CUITe_HtmlComboBox();
            }
            else if (control.GetType() == typeof(HtmlDiv))
            {
                _con = new CUITe_HtmlDiv();
            }
            else if (control.GetType() == typeof(HtmlDocument))
            {
                _con = new CUITe_HtmlDocument();
            }
            else if (control.GetType() == typeof(HtmlEdit) && (string.Compare(control.Type, "password", true) == 0))
            {
                _con = new CUITe_HtmlPassword();
            }
            else if (control.GetType() == typeof(HtmlEdit))
            {
                _con = new CUITe_HtmlEdit();
            }
            else if (control.GetType() == typeof(HtmlEditableDiv))
            {
                _con = new CUITe_HtmlEditableDiv();
            }
            else if (control.GetType() == typeof(HtmlFileInput))
            {
                _con = new CUITe_HtmlFileInput();
            }
            else if (control.GetType() == typeof(HtmlHyperlink))
            {
                _con = new CUITe_HtmlHyperlink();
            }
            else if (control.GetType() == typeof(HtmlImage))
            {
                _con = new CUITe_HtmlImage();
            }
            else if (control.GetType() == typeof(HtmlInputButton))
            {
                _con = new CUITe_HtmlInputButton();
            }
            else if (control.GetType() == typeof(HtmlLabel))
            {
                _con = new CUITe_HtmlLabel();
            }
            else if (control.GetType() == typeof(HtmlList))
            {
                _con = new CUITe_HtmlList();
            }
            else if (control.GetType() == typeof(HtmlRadioButton))
            {
                _con = new CUITe_HtmlRadioButton();
            }
            else if (control.GetType() == typeof(HtmlSpan))
            {
                _con = new CUITe_HtmlSpan();
            }
            else if (control.GetType() == typeof(HtmlEditableSpan))
            {
                _con = new CUITe_HtmlEditableSpan();
            }
            else if (control.GetType() == typeof(HtmlTable))
            {
                _con = new CUITe_HtmlTable();
            }
            else if (control.GetType() == typeof(HtmlCell))
            {
                _con = new CUITe_HtmlCell();
            }
            else if (control.GetType() == typeof(HtmlTextArea))
            {
                _con = new CUITe_HtmlTextArea();
            }
            else if (control.GetType() == typeof(HtmlIFrame))
            {
                _con = new CUITe_HtmlIFrame();
            }
            else if (control.GetType() == typeof(HtmlCustom))
            {
                switch (control.TagName.ToLower())
                {
                    case "p":
                        _con = new CUITe_HtmlParagraph();
                        break;
                    case "h1":
                        _con = new CUITe_HtmlHeading1();
                        break;
                    case "h2":
                        _con = new CUITe_HtmlHeading2();
                        break;
                    case "h3":
                        _con = new CUITe_HtmlHeading3();
                        break;
                    case "h4":
                        _con = new CUITe_HtmlHeading4();
                        break;
                    case "h5":
                        _con = new CUITe_HtmlHeading5();
                        break;
                    case "h6":
                        _con = new CUITe_HtmlHeading6();
                        break;
                    case "ul":
                        _con = new CUITe_HtmlUnorderedList();
                        break;
                    case "ol":
                        _con = new CUITe_HtmlOrderedList();
                        break;
                    case "li":
                        _con = new CUITe_HtmlListItem();
                        break;
                    case "ins":
                        _con = new CUITe_HtmlIns();
                        break;
                    default:
                        _con = new CUITe_HtmlCustom(control.TagName);
                        break;
                }
            }
            else
            {
                throw new Exception(string.Format("WrapUtil: '{0}' not supported", control.GetType().Name));
            }
            ((ICUITe_ControlBase)_con).WrapReady(control);
            return _con;
        }

Coordinator
Jul 16, 2013 at 7:24 AM
Thank you, @deepakguna! :)

This is now incorporated in CUITe as of changeset 28352.