O2 Scripts/WatiN/Open page and show html elements in new window
From
this example shows how to use WatiN to start a new instance of Internet Explorer and open a pop-up window with details about all page's HTML elements
screenshots
- open O2's Simple Script Editor and past the code included below
- click 'Execute' and an new Instance of IE will open
- together with a pop-up window that will show the current Html Element details
- it is possible to manipulate the live HTML elements in real time
- for example:
- expand the 'INPUT' node
- select the first 'Google Search' node
- enter 'TEST SEARCH' in the Value element (bottom of the Properties view)
- note how the value was reflected in the Internet Explorer instance
source code
var ie = "http://www.google.com".ie(); var hostPanel = O2Gui.open<Panel>("WatiN element details",400,400); var controls = hostPanel.add_1x1("Html elements", "Propeties"); var propertyGrid = controls[1].add_PropertyGrid(); controls[0].add_TreeView() .add_Nodes(ie.elements().indexedByTagName()) .sort() .showSelection() .beforeExpand<List<Element>>( (treeNode, elements) => { try { treeNode.add_Nodes(elements);} catch(Exception ex) { ex.log("in beforeExpand<List<Element>>");} }) .afterSelect<Element>((element)=> propertyGrid.show(element)) .afterSelect<List<Element>>((elements)=> propertyGrid.show(elements[0])); //O2File:WatiN_IE_ExtensionMethods.cs //O2File:WatiN_IE.cs //using SHDocVw //using WatiN.Core //O2Ref:Interop.SHDocVw.dll //O2Ref:WatiN.Core.1x.dll





