public void SetWindowProperties(WatinScript watscript, string BrowserName, IHTMLElement element) { wscript = watscript; browsername = BrowserName; currentelement = element; this.Text = string.Format(Properties.Resources.FunctionExplorer, element.GetType().ToString()); IHTMLDOMNode node = element as IHTMLDOMNode; lbAttributes.Items.Clear(); lbAttributes.Items.Add(string.Format("tagName={0}", element.tagName), false); string strValue = ""; string strFindMethod = wscript.GetFindMethod(element, ref strValue); foreach (IHTMLDOMAttribute attr in node.attributes) { if (attr.specified) { if (strFindMethod.ToLower() == attr.nodeName.ToLower()) { lbAttributes.Items.Add(attr.nodeName + "=" + attr.nodeValue, true); } else { lbAttributes.Items.Add(attr.nodeName + "=" + attr.nodeValue, false); } } } lbAttributes.Items.Add("innerHTML=" + element.innerHTML, false); if (strFindMethod == "innertext") { lbAttributes.Items.Add("innerText=" + element.innerText, true); } else { lbAttributes.Items.Add("innerText=" + element.innerText, false); } lbAttributes.Items.Add("outerHTML=" + element.outerHTML, false); lbAttributes.Items.Add("outerText=" + element.outerText, false); json = CreateJSONData(element); LoadTabs(element); }
public void SetWindowProperties(WatinScript watscript, string BrowserName, IHTMLElement element) { wscript = watscript; browsername = BrowserName; currentelement = element; this.Text = string.Format(Properties.Resources.FunctionExplorer,element.GetType().ToString()); IHTMLDOMNode node = element as IHTMLDOMNode; lbAttributes.Items.Clear(); lbAttributes.Items.Add(string.Format("tagName={0}",element.tagName), false); string strValue = ""; string strFindMethod = wscript.GetFindMethod(element, ref strValue); foreach (IHTMLDOMAttribute attr in node.attributes) { if (attr.specified) { if (strFindMethod.ToLower()==attr.nodeName.ToLower()) { lbAttributes.Items.Add(attr.nodeName + "=" + attr.nodeValue, true); } else { lbAttributes.Items.Add(attr.nodeName + "=" + attr.nodeValue, false); } } } lbAttributes.Items.Add("innerHTML="+element.innerHTML, false); if (strFindMethod=="innertext") { lbAttributes.Items.Add("innerText=" + element.innerText, true); } else { lbAttributes.Items.Add("innerText=" + element.innerText, false); } lbAttributes.Items.Add("outerHTML=" + element.outerHTML, false); lbAttributes.Items.Add("outerText=" + element.outerText, false); json = CreateJSONData(element); LoadTabs(element); }
public void SetWindowProperties(WatinScript watscript, string BrowserName, IHTMLElement element) { tabControl1.SelectedTab = pageMethods; wscript = watscript; browsername = BrowserName; currentelement = element; this.Text = "Property Explorer - " + element.GetType().ToString(); IHTMLDOMNode node = element as IHTMLDOMNode; gridProperties.Rows.Add("tagName", element.tagName); foreach (IHTMLDOMAttribute attr in node.attributes) { if (attr.specified) { gridProperties.Rows.Add(attr.nodeName, attr.nodeValue); } } gridProperties.Rows.Add("innerHTML", element.innerHTML); gridProperties.Rows.Add("innerText", element.innerText); gridProperties.Rows.Add("outerHTML", element.outerHTML); gridProperties.Rows.Add("outerText", element.outerText); rbSelectByText.Enabled = false; comboSelectByText.Enabled = false; rbSelectByValue.Enabled = false; comboSelectByValue.Enabled = false; rbSetFilename.Enabled = false; txtSetFilename.Enabled = false; btnSetFilename.Enabled = false; rbChecked.Enabled = false; rbUnchecked.Enabled = false; string tagtype = watscript.ActiveElementAttribute(element, "type").ToLower(); if (element.tagName.ToLower() == "input" && tagtype == "file") { rbSetFilename.Enabled = true; txtSetFilename.Enabled = true; btnSetFilename.Enabled = true; } else if (element.tagName.ToLower() == "input" && (tagtype == "radio" || tagtype == "checkbox")) { rbChecked.Enabled = true; rbUnchecked.Enabled = true; } else if (element.tagName.ToLower() == "select") { rbSelectByText.Enabled = true; comboSelectByText.Enabled = true; rbSelectByValue.Enabled = true; comboSelectByValue.Enabled = true; comboSelectByText.Items.Clear(); comboSelectByValue.Items.Clear(); mshtml.IHTMLSelectElement sel = element as mshtml.IHTMLSelectElement; if (sel==null) { return; } for (int i = 0; i < sel.length; i++) { mshtml.IHTMLOptionElement op = sel.item(i, i) as mshtml.IHTMLOptionElement; comboSelectByText.Items.Add(op.text); if (op.value==null) { comboSelectByText.Items.Add(op.text); } else { comboSelectByValue.Items.Add(op.value); } } } }
public void SetURL(frmMain MainForm, WatinScript script, string URL) { this.MainScript = script; this.m_MainForm = MainForm; this.cEXWB1.Navigate(URL); }
public void SetWindowProperties(WatinScript watscript, string BrowserName, IHTMLElement element) { tabControl1.SelectedTab = pageMethods; wscript = watscript; browsername = BrowserName; currentelement = element; this.Text = "Property Explorer - " + element.GetType().ToString(); IHTMLDOMNode node = element as IHTMLDOMNode; gridProperties.Rows.Add("tagName", element.tagName); foreach (IHTMLDOMAttribute attr in node.attributes) { if (attr.specified) { gridProperties.Rows.Add(attr.nodeName, attr.nodeValue); } } gridProperties.Rows.Add("innerHTML", element.innerHTML); gridProperties.Rows.Add("innerText", element.innerText); gridProperties.Rows.Add("outerHTML", element.outerHTML); gridProperties.Rows.Add("outerText", element.outerText); rbSelectByText.Enabled = false; comboSelectByText.Enabled = false; rbSelectByValue.Enabled = false; comboSelectByValue.Enabled = false; rbSetFilename.Enabled = false; txtSetFilename.Enabled = false; btnSetFilename.Enabled = false; rbChecked.Enabled = false; rbUnchecked.Enabled = false; string tagtype = watscript.ActiveElementAttribute(element, "type").ToLower(); if (element.tagName.ToLower() == "input" && tagtype == "file") { rbSetFilename.Enabled = true; txtSetFilename.Enabled = true; btnSetFilename.Enabled = true; } else if (element.tagName.ToLower() == "input" && (tagtype == "radio" || tagtype == "checkbox")) { rbChecked.Enabled = true; rbUnchecked.Enabled = true; } else if (element.tagName.ToLower() == "select") { rbSelectByText.Enabled = true; comboSelectByText.Enabled = true; rbSelectByValue.Enabled = true; comboSelectByValue.Enabled = true; comboSelectByText.Items.Clear(); comboSelectByValue.Items.Clear(); mshtml.IHTMLSelectElement sel = element as mshtml.IHTMLSelectElement; if (sel == null) { return; } for (int i = 0; i < sel.length; i++) { mshtml.IHTMLOptionElement op = sel.item(i, i) as mshtml.IHTMLOptionElement; comboSelectByText.Items.Add(op.text); if (op.value == null) { comboSelectByText.Items.Add(op.text); } else { comboSelectByValue.Items.Add(op.value); } } } }