Esempio n. 1
0
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            //foreach (WatiN.Core.TextField obj in ie.TextFields)
            //{
            //    obj.Highlight(false);
            //}

            //foreach (WatiN.Core.Button obj in ie.Buttons)
            //{
            //    obj.Highlight(false);
            //}
            //foreach (WatiN.Core.Div obj in ie.Divs)
            //{
            //    obj.Highlight(false);
            //}
            txtSelect.Text = e.Node.Text;
            Div div = ie.Div(Find.ById(txtSelect.Text));

            if (div != null && div.Exists)
            {
                div.Highlight(true);
            }
            TextField text = ie.TextField(Find.ByName(txtSelect.Text));

            if (text != null && text.Exists)
            {
                text.Highlight(true);
                text.Select();
            }
            WatiN.Core.Button butt = ie.Button(Find.ByValue(txtSelect.Text));
            if (butt != null && butt.Exists)
            {
                butt.Highlight(true);
            }
        }
Esempio n. 2
0
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            //foreach (WatiN.Core.TextField obj in ie.TextFields)
            //{
            //    obj.Highlight(false);
            //}

            //foreach (WatiN.Core.Button obj in ie.Buttons)
            //{
            //    obj.Highlight(false);
            //}
            //foreach (WatiN.Core.Div obj in ie.Divs)
            //{
            //    obj.Highlight(false);
            //}\

            txtSelect.Text = e.Node.Text;
            string Value = e.Node.Text;

            if (Value.IndexOf(" = ") >= 0)
            {
                Value = Value.Split('=')[1].Trim();
            }
            if (e.Node.FullPath.IndexOf("Div") >= 0)
            {
                if (txtSelect.Text.IndexOf("Name = ") >= 0)
                {
                    Div div = ie.Div(Find.ByName(Value));
                    if (div != null && div.Exists)
                    {
                        div.Highlight(true);
                    }
                }
                else
                {
                    Div div = ie.Div(Find.ById(Value));
                    if (div != null && div.Exists)
                    {
                        div.Highlight(true);
                    }
                }
            }
            else if (e.Node.FullPath.IndexOf("TextBox") >= 0)
            {
                TextField text = ie.TextField(Find.ByName(Value));
                if (text != null && text.Exists)
                {
                    text.Highlight(true);
                    text.Select();
                }
            }
            else if (e.Node.FullPath.IndexOf("Button") >= 0)
            {
                WatiN.Core.Button butt = ie.Button(Find.ByValue(Value));
                if (butt != null && butt.Exists)
                {
                    butt.Highlight(true);
                }
            }
            else if (e.Node.FullPath.IndexOf("Link") >= 0)
            {
                if (txtSelect.Text.IndexOf("Class = ") >= 0)
                {
                    WatiN.Core.Link link = ie.Link(Find.ByClass(Value));
                    if (link != null && link.Exists)
                    {
                        link.Highlight(true);
                    }
                }
                else
                {
                    WatiN.Core.Link link = ie.Link(Find.ByText(Value));
                    if (link != null && link.Exists)
                    {
                        link.Highlight(true);
                    }
                }
            }
        }