com.atlassian.confluence.htmlunit
Class ConfluenceHtmlUnitDialog

java.lang.Object
  extended by com.atlassian.confluence.htmlunit.HtmlUnitDialog
      extended by com.atlassian.confluence.htmlunit.ConfluenceHtmlUnitDialog
All Implemented Interfaces:
net.sourceforge.jwebunit.api.IJWebUnitDialog

public class ConfluenceHtmlUnitDialog
extends HtmlUnitDialog

This class is a copy of HtmlUnitDialog with modifications to the initWebClient() method to allow setting configuration from properties file.


Field Summary
static com.gargoylesoftware.htmlunit.Cache newCache
           
 
Fields inherited from class com.atlassian.confluence.htmlunit.HtmlUnitDialog
expectedJavascriptAlerts, expectedJavascriptConfirms, expectedJavascriptPrompts, form, jsEnabled, wc, win
 
Constructor Summary
ConfluenceHtmlUnitDialog()
           
 
Method Summary
protected  com.gargoylesoftware.htmlunit.html.ClickableElement getButton(String buttonId)
          Overridden to use the correct window in the case of pop-ups.
 com.atlassian.util.concurrent.Supplier<JSoupTester> getJSoupSupplier()
           
static com.atlassian.util.concurrent.Supplier<JSoupTester> getJSoupSupplier(net.sourceforge.jwebunit.junit.WebTester webTester)
          Returns a supplier for the JSoupTester which might be used for querying the DOM with CSS selectors.
 int getTimeout()
           
 com.gargoylesoftware.htmlunit.html.DomNode getWindowDomNode()
          Expose internals for some tests.
 void gotoPage(URL initialURL)
           
protected  void initWebClient()
          Overridden to: set browser version not throw javascript exceptions set socket timeouts, and increase the number of client connections.
 boolean isJavascriptEnabled()
           
 void setInputValue(String inputId, String value)
          Sets the input value of the given input.
 void setTextField(String fieldName, String text)
          Overridden to allow setting of hidden fields.
 void setTimeout(int timeout)
           
protected  void setWorkingForm(com.gargoylesoftware.htmlunit.html.HtmlForm newForm)
          Overridden for additional logging.
 void uncheckCheckbox(String checkBoxName)
          Deselect a specified checkbox.
 void uncheckCheckbox(String checkBoxName, String value)
           
 
Methods inherited from class com.atlassian.confluence.htmlunit.HtmlUnitDialog
beginAt, checkCheckbox, checkCheckbox, clickButton, clickButtonWithText, clickElementByXPath, clickLink, clickLinkWithExactText, clickLinkWithImage, clickLinkWithText, clickRadioOption, closeBrowser, closeWindow, getButtonWithText, getCookies, getCurrentPage, getCurrentPageTitle, getElement, getElementAttributByXPath, getElementTextByXPath, getForm, getHiddenFieldValue, getHtmlTable, getInputStream, getInputStream, getPageSource, getPageText, getPageTitle, getPageURL, getResetButton, getSelectedOptions, getSelectedRadio, getSelectOptionLabelForValue, getSelectOptionValueForLabel, getSelectOptionValues, getServerResponse, getSubmitButton, getSubmitButton, getTable, getTestContext, getTextFieldValue, getWindowCount, gotoFrame, gotoRootWindow, gotoWindow, gotoWindow, gotoWindowByTitle, hasButton, hasButtonWithText, hasElement, hasElementByXPath, hasForm, hasForm, hasFormInputNamed, hasFormParameterNamed, hasFormSelectNamed, hasFrame, hasLink, hasLinkWithExactText, hasLinkWithImage, hasLinkWithText, hasRadioOption, hasResetButton, hasResetButton, hasSelectOption, hasSelectOptionValue, hasSubmitButton, hasSubmitButton, hasSubmitButton, hasTable, hasWindow, hasWindowByTitle, isCheckboxSelected, isCheckboxSelected, isMatchInElement, isTextInElement, isTextInTable, reset, selectOptions, setExpectedJavaScriptAlert, setExpectedJavaScriptConfirm, setExpectedJavaScriptPrompt, setScriptingEnabled, setWorkingForm, setWorkingForm, submit, submit, submit, unselectOptions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

newCache

public static final com.gargoylesoftware.htmlunit.Cache newCache
Constructor Detail

ConfluenceHtmlUnitDialog

public ConfluenceHtmlUnitDialog()
Method Detail

gotoPage

public void gotoPage(URL initialURL)
              throws net.sourceforge.jwebunit.exception.TestingEngineResponseException
Specified by:
gotoPage in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
Overrides:
gotoPage in class HtmlUnitDialog
Throws:
net.sourceforge.jwebunit.exception.TestingEngineResponseException

setTextField

public void setTextField(String fieldName,
                         String text)
Overridden to allow setting of hidden fields.

Specified by:
setTextField in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
Overrides:
setTextField in class HtmlUnitDialog
Parameters:
fieldName - name of the input element or textarea
text - parameter value to submit for the element.

uncheckCheckbox

public void uncheckCheckbox(String checkBoxName)
Description copied from class: HtmlUnitDialog
Deselect a specified checkbox. If the checkbox is already unchecked then the checkbox will stay unchecked.

Specified by:
uncheckCheckbox in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
Overrides:
uncheckCheckbox in class HtmlUnitDialog
Parameters:
checkBoxName - name of checkbox to be deselected.

uncheckCheckbox

public void uncheckCheckbox(String checkBoxName,
                            String value)
Specified by:
uncheckCheckbox in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
Overrides:
uncheckCheckbox in class HtmlUnitDialog

initWebClient

protected void initWebClient()
Overridden to:

Overrides:
initWebClient in class HtmlUnitDialog

setWorkingForm

protected void setWorkingForm(com.gargoylesoftware.htmlunit.html.HtmlForm newForm)
Overridden for additional logging.


getButton

protected com.gargoylesoftware.htmlunit.html.ClickableElement getButton(String buttonId)
Overridden to use the correct window in the case of pop-ups.


getWindowDomNode

public com.gargoylesoftware.htmlunit.html.DomNode getWindowDomNode()
Expose internals for some tests.


setInputValue

public void setInputValue(String inputId,
                          String value)
Sets the input value of the given input. Only use this when input is not in a form and you don't want 'form not present' assertion failure.


isJavascriptEnabled

public boolean isJavascriptEnabled()

getTimeout

public int getTimeout()

setTimeout

public void setTimeout(int timeout)

getJSoupSupplier

public com.atlassian.util.concurrent.Supplier<JSoupTester> getJSoupSupplier()

getJSoupSupplier

public static com.atlassian.util.concurrent.Supplier<JSoupTester> getJSoupSupplier(net.sourceforge.jwebunit.junit.WebTester webTester)
Returns a supplier for the JSoupTester which might be used for querying the DOM with CSS selectors.

The given WebTester is expected to have a ConfluenceHtmlUnitDialog configured. Do not cache references on the JSoupTester returned by the supplier as it might change after any interaction with the client (stale DOM). Please be aware that acquiring the JSoupTester results in the current page being re-parsed into an in-memory representation, adding to the time and resource-consumption due to JWebUnit's own parsing on page initialisation.

There is currently no way to relate an element in JWebUnit's DOM to one in JSoup's DOM, thus if you need to interact with the HTTP client (e.g. click elements) you'll have to use JWebUnit's facilities (e.g. XPath) for locating these elements.



Copyright © 2003-2012 Atlassian. All Rights Reserved.