/** @see com.aptana.ide.editors.unified.ContributedBrowser#execute(java.lang.String) */
 public boolean execute(String script) {
   nsIDOMDocument document = internalGetDocument();
   if (document != null) {
     nsIDOMElement se = document.createElement("script"); // $NON-NLS-1$
     nsIDOMHTMLScriptElement scriptBlock =
         (nsIDOMHTMLScriptElement)
             se.queryInterface(nsIDOMHTMLScriptElement.NS_IDOMHTMLSCRIPTELEMENT_IID);
     String s2 =
         "if("
             + script
             + "){"
             + "document.getElementById('execute').setAttribute('text','success');}"; //$NON-NLS-1$
                                                                                      // //$NON-NLS-2$ //$NON-NLS-3$
     scriptBlock.setText(s2);
     nsIDOMElement executeBlock = document.getElementById("execute"); // $NON-NLS-1$
     if (executeBlock == null) {
       executeBlock = document.createElement("div"); // $NON-NLS-1$
       executeBlock.setAttribute("id", "execute"); // $NON-NLS-1$ //$NON-NLS-2$
       nsIDOMNode body = document.getElementsByTagName("body").item(0); // $NON-NLS-1$
       body.appendChild(executeBlock);
     }
     executeBlock.setAttribute("text", ""); // $NON-NLS-1$ //$NON-NLS-2$
     nsIDOMNode head = document.getElementsByTagName("head").item(0); // $NON-NLS-1$
     head.appendChild(scriptBlock);
     executeBlock = document.getElementById("execute"); // $NON-NLS-1$
     return "success".equals(executeBlock.getAttribute("text")); // $NON-NLS-1$ //$NON-NLS-2$
   } else {
     return false;
   }
 }
 /**
  * Highlights an element in this browser
  *
  * @param element - element to highlight
  */
 public void highlightElement(nsIDOMNode element) {
   if (element.getNodeType() == nsIDOMNode.ELEMENT_NODE) {
     selectionBox.highlight(
         (nsIDOMElement) element.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID));
   } else {
     selectionBox.hide();
   }
 }
  /**
   * Asserts selected node in Visual pane has text textToHave
   *
   * @param webBrowser
   * @param nodeNameToContain
   */
  private static void assertSelectedNodeHasText(SWTBotWebBrowser webBrowser, String textToHave) {

    nsIDOMNode selectedNode = webBrowser.getSelectedDomNode();

    assertNotNull("There is no selected node within Visual pane of VPE", selectedNode);
    assertNotNull(
        "Selected node within Visual pane of VPE has no value", selectedNode.getNodeValue());

    final String nodeValue = selectedNode.getNodeValue();

    assertTrue(
        "Selected node within Visual pane has value:\n"
            + nodeValue
            + "\nbut has to have value:\n"
            + textToHave,
        textToHave.equals(nodeValue));
  }
  /**
   * check minValue and maxValue
   *
   * <p>inputNumberSlider has next structure <code>
   * 	<table>
   * 			<tr>
   * 				<td>minValue</td>
   * 				<td>maxValue</td>
   * 			</tr>
   *  		....
   *  	</table>
   *  </code>
   */
  private void checkMinMaxValue(
      nsIDOMNode defaultInputSlider, int expectedMinValue, int expectedMaxValue) {

    // get "tr" element
    nsIDOMNode trNode = defaultInputSlider.getChildNodes().item(0);
    assertNotNull(trNode);
    // get first "td" element which contain minValue
    nsIDOMNode td1Node = trNode.getChildNodes().item(0);
    assertNotNull(td1Node);

    // get second "td" element which contain maxValue
    nsIDOMNode td2Node = trNode.getChildNodes().item(1);
    assertNotNull(td2Node);

    // get minValue
    nsIDOMNode minValue = td1Node.getChildNodes().item(0);
    assertNotNull(minValue);

    // get maxValue
    nsIDOMNode maxValue = td2Node.getChildNodes().item(0);
    assertNotNull(maxValue);

    // check min value
    String minValueString = minValue.getNodeValue();
    assertNotNull(minValueString);
    assertEquals(expectedMinValue, Integer.parseInt(minValueString));

    // check max value
    String maxValueString = maxValue.getNodeValue();
    assertNotNull(maxValueString);
    assertEquals(expectedMaxValue, Integer.parseInt(maxValueString));

    return;
  }