net.sourceforge.jwebunit.selenium
Class SeleniumTestingEngineImpl
java.lang.Object
net.sourceforge.jwebunit.selenium.SeleniumTestingEngineImpl
- All Implemented Interfaces:
- ITestingEngine
public class SeleniumTestingEngineImpl
- extends Object
- implements ITestingEngine
Acts as the wrapper for Selenium access. A testing engine is initialized with a given URL, and maintains
conversational state as the dialog progresses through link navigation, form submission, etc.
- Author:
- Julien Henry
|
Method Summary |
void |
beginAt(URL aInitialURL,
TestContext aTestContext)
|
void |
checkCheckbox(String checkBoxName)
|
void |
checkCheckbox(String checkBoxName,
String value)
|
void |
clickButton(String buttonId)
|
void |
clickButtonWithText(String buttonValueText)
|
void |
clickElementByXPath(String xpath)
|
void |
clickLink(String anID)
|
void |
clickLinkWithExactText(String linkText,
int index)
|
void |
clickLinkWithImage(String imageFileName,
int index)
|
void |
clickLinkWithText(String linkText,
int index)
|
void |
clickRadioOption(String radioGroup,
String radioOptionValue)
|
void |
closeBrowser()
|
void |
closeWindow()
|
protected String |
formSelector()
|
List |
getCookies()
|
String |
getElementAttributByXPath(String xpath,
String attribut)
|
String |
getElementTextByXPath(String xpath)
|
String |
getHiddenFieldValue(String paramName)
|
InputStream |
getInputStream()
|
InputStream |
getInputStream(URL url)
|
String |
getJavascriptAlert()
|
String |
getPageSource()
|
String |
getPageText()
|
String |
getPageTitle()
|
URL |
getPageURL()
|
protected int |
getRadioCount(String radioGroup)
|
String[] |
getSelectedOptions(String selectName)
|
String[] |
getSelectedOptions(String selectName,
int index)
|
String |
getSelectedRadio(String radioGroup)
|
String |
getSelectOptionLabelForValue(String selectName,
int index,
String optionValue)
|
String |
getSelectOptionLabelForValue(String selectName,
String optionValue)
|
String |
getSelectOptionValueForLabel(String selectName,
int index,
String optionLabel)
|
String |
getSelectOptionValueForLabel(String selectName,
String optionLabel)
|
String[] |
getSelectOptionValues(String selectName)
|
String[] |
getSelectOptionValues(String selectName,
int index)
|
String |
getServerResponse()
|
Table |
getTable(String tableSummaryNameOrId)
|
TestContext |
getTestContext()
|
String |
getTextFieldValue(String paramName)
|
int |
getWindowCount()
|
void |
goBack()
|
void |
gotoFrame(String frameName)
|
void |
gotoPage(URL url)
|
void |
gotoRootWindow()
|
void |
gotoWindow(int windowID)
|
void |
gotoWindow(String windowName)
|
void |
gotoWindowByTitle(String title)
|
boolean |
hasButton(String buttonId)
|
boolean |
hasButtonWithText(String text)
|
boolean |
hasElement(String anID)
|
boolean |
hasElementByXPath(String xpath)
|
boolean |
hasForm()
|
boolean |
hasForm(String nameOrID)
|
boolean |
hasFormParameterNamed(String paramName)
|
boolean |
hasFrame(String frameName)
|
boolean |
hasLink(String anId)
|
boolean |
hasLinkWithExactText(String linkText,
int index)
|
boolean |
hasLinkWithImage(String imageFileName,
int index)
|
boolean |
hasLinkWithText(String linkText,
int index)
|
boolean |
hasRadioOption(String radioGroup,
String radioOptionValue)
|
boolean |
hasResetButton()
|
boolean |
hasResetButton(String nameOrID)
|
boolean |
hasSelectOption(String selectName,
int index,
String optionLabel)
|
boolean |
hasSelectOption(String selectName,
String optionLabel)
|
boolean |
hasSelectOptionValue(String selectName,
int index,
String optionValue)
|
boolean |
hasSelectOptionValue(String selectName,
String optionValue)
|
boolean |
hasSubmitButton()
|
boolean |
hasSubmitButton(String nameOrID)
|
boolean |
hasSubmitButton(String nameOrID,
String value)
|
boolean |
hasTable(String tableSummaryNameOrId)
|
boolean |
hasWindow(String windowName)
|
boolean |
hasWindowByTitle(String title)
|
boolean |
isCheckboxSelected(String checkBoxName)
|
boolean |
isCheckboxSelected(String checkBoxName,
String checkBoxValue)
|
boolean |
isMatchInElement(String elementID,
String regexp)
|
boolean |
isTextInElement(String elementID,
String text)
|
void |
refresh()
|
void |
reset()
|
void |
selectOptions(String selectName,
int index,
String[] optionsValue)
|
void |
selectOptions(String selectName,
String[] optionsValue)
|
void |
setExpectedJavaScriptAlert(JavascriptAlert[] alerts)
|
void |
setExpectedJavaScriptConfirm(JavascriptConfirm[] confirms)
|
void |
setExpectedJavaScriptPrompt(JavascriptPrompt[] prompts)
|
void |
setHiddenField(String inputName,
String text)
|
void |
setScriptingEnabled(boolean value)
|
void |
setTestContext(TestContext testContext)
|
void |
setTextField(String inputName,
String text)
|
void |
setWorkingForm(int index)
|
void |
setWorkingForm(String nameOrId,
int index)
|
void |
submit()
|
void |
submit(String nameOrID)
|
void |
submit(String nameOrID,
String value)
|
void |
uncheckCheckbox(String checkBoxName)
|
void |
uncheckCheckbox(String checkBoxName,
String value)
|
void |
unselectOptions(String selectName,
int index,
String[] options)
|
void |
unselectOptions(String selectName,
String[] options)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SeleniumTestingEngineImpl
public SeleniumTestingEngineImpl()
beginAt
public void beginAt(URL aInitialURL,
TestContext aTestContext)
throws TestingEngineResponseException
- Specified by:
beginAt in interface ITestingEngine
- Throws:
TestingEngineResponseException
checkCheckbox
public void checkCheckbox(String checkBoxName,
String value)
- Specified by:
checkCheckbox in interface ITestingEngine
checkCheckbox
public void checkCheckbox(String checkBoxName)
- Specified by:
checkCheckbox in interface ITestingEngine
clickButton
public void clickButton(String buttonId)
- Specified by:
clickButton in interface ITestingEngine
clickButtonWithText
public void clickButtonWithText(String buttonValueText)
- Specified by:
clickButtonWithText in interface ITestingEngine
clickElementByXPath
public void clickElementByXPath(String xpath)
- Specified by:
clickElementByXPath in interface ITestingEngine
clickLink
public void clickLink(String anID)
- Specified by:
clickLink in interface ITestingEngine
clickLinkWithExactText
public void clickLinkWithExactText(String linkText,
int index)
- Specified by:
clickLinkWithExactText in interface ITestingEngine
clickLinkWithImage
public void clickLinkWithImage(String imageFileName,
int index)
- Specified by:
clickLinkWithImage in interface ITestingEngine
clickLinkWithText
public void clickLinkWithText(String linkText,
int index)
- Specified by:
clickLinkWithText in interface ITestingEngine
clickRadioOption
public void clickRadioOption(String radioGroup,
String radioOptionValue)
- Specified by:
clickRadioOption in interface ITestingEngine
closeBrowser
public void closeBrowser()
throws TestingEngineResponseException
- Specified by:
closeBrowser in interface ITestingEngine
- Throws:
TestingEngineResponseException
closeWindow
public void closeWindow()
- Specified by:
closeWindow in interface ITestingEngine
getPageSource
public String getPageSource()
- Specified by:
getPageSource in interface ITestingEngine
getPageText
public String getPageText()
- Specified by:
getPageText in interface ITestingEngine
getPageTitle
public String getPageTitle()
- Specified by:
getPageTitle in interface ITestingEngine
getCookies
public List getCookies()
- Specified by:
getCookies in interface ITestingEngine
getSelectedOptions
public String[] getSelectedOptions(String selectName)
- Specified by:
getSelectedOptions in interface ITestingEngine
getSelectOptionLabelForValue
public String getSelectOptionLabelForValue(String selectName,
String optionValue)
- Specified by:
getSelectOptionLabelForValue in interface ITestingEngine
getSelectOptionValueForLabel
public String getSelectOptionValueForLabel(String selectName,
String optionLabel)
- Specified by:
getSelectOptionValueForLabel in interface ITestingEngine
getSelectOptionValues
public String[] getSelectOptionValues(String selectName)
- Specified by:
getSelectOptionValues in interface ITestingEngine
getSelectedOptions
public String[] getSelectedOptions(String selectName,
int index)
- Specified by:
getSelectedOptions in interface ITestingEngine
getSelectOptionLabelForValue
public String getSelectOptionLabelForValue(String selectName,
int index,
String optionValue)
- Specified by:
getSelectOptionLabelForValue in interface ITestingEngine
getSelectOptionValueForLabel
public String getSelectOptionValueForLabel(String selectName,
int index,
String optionLabel)
- Specified by:
getSelectOptionValueForLabel in interface ITestingEngine
getSelectOptionValues
public String[] getSelectOptionValues(String selectName,
int index)
- Specified by:
getSelectOptionValues in interface ITestingEngine
getServerResponse
public String getServerResponse()
- Specified by:
getServerResponse in interface ITestingEngine
goBack
public void goBack()
gotoFrame
public void gotoFrame(String frameName)
- Specified by:
gotoFrame in interface ITestingEngine
gotoPage
public void gotoPage(URL url)
throws TestingEngineResponseException
- Specified by:
gotoPage in interface ITestingEngine
- Throws:
TestingEngineResponseException
gotoRootWindow
public void gotoRootWindow()
- Specified by:
gotoRootWindow in interface ITestingEngine
gotoWindow
public void gotoWindow(String windowName)
- Specified by:
gotoWindow in interface ITestingEngine
gotoWindowByTitle
public void gotoWindowByTitle(String title)
- Specified by:
gotoWindowByTitle in interface ITestingEngine
hasButton
public boolean hasButton(String buttonId)
- Specified by:
hasButton in interface ITestingEngine
hasButtonWithText
public boolean hasButtonWithText(String text)
- Specified by:
hasButtonWithText in interface ITestingEngine
hasElement
public boolean hasElement(String anID)
- Specified by:
hasElement in interface ITestingEngine
hasElementByXPath
public boolean hasElementByXPath(String xpath)
- Specified by:
hasElementByXPath in interface ITestingEngine
hasForm
public boolean hasForm()
- Specified by:
hasForm in interface ITestingEngine
hasForm
public boolean hasForm(String nameOrID)
- Specified by:
hasForm in interface ITestingEngine
hasFormParameterNamed
public boolean hasFormParameterNamed(String paramName)
- Specified by:
hasFormParameterNamed in interface ITestingEngine
hasFrame
public boolean hasFrame(String frameName)
- Specified by:
hasFrame in interface ITestingEngine
hasLink
public boolean hasLink(String anId)
- Specified by:
hasLink in interface ITestingEngine
hasLinkWithExactText
public boolean hasLinkWithExactText(String linkText,
int index)
- Specified by:
hasLinkWithExactText in interface ITestingEngine
hasLinkWithImage
public boolean hasLinkWithImage(String imageFileName,
int index)
- Specified by:
hasLinkWithImage in interface ITestingEngine
hasLinkWithText
public boolean hasLinkWithText(String linkText,
int index)
- Specified by:
hasLinkWithText in interface ITestingEngine
hasRadioOption
public boolean hasRadioOption(String radioGroup,
String radioOptionValue)
- Specified by:
hasRadioOption in interface ITestingEngine
hasSelectOption
public boolean hasSelectOption(String selectName,
String optionLabel)
- Specified by:
hasSelectOption in interface ITestingEngine
hasSelectOptionValue
public boolean hasSelectOptionValue(String selectName,
String optionValue)
- Specified by:
hasSelectOptionValue in interface ITestingEngine
hasSelectOption
public boolean hasSelectOption(String selectName,
int index,
String optionLabel)
- Specified by:
hasSelectOption in interface ITestingEngine
hasSelectOptionValue
public boolean hasSelectOptionValue(String selectName,
int index,
String optionValue)
- Specified by:
hasSelectOptionValue in interface ITestingEngine
hasSubmitButton
public boolean hasSubmitButton()
- Specified by:
hasSubmitButton in interface ITestingEngine
hasSubmitButton
public boolean hasSubmitButton(String nameOrID,
String value)
- Specified by:
hasSubmitButton in interface ITestingEngine
hasSubmitButton
public boolean hasSubmitButton(String nameOrID)
- Specified by:
hasSubmitButton in interface ITestingEngine
hasResetButton
public boolean hasResetButton()
- Specified by:
hasResetButton in interface ITestingEngine
hasResetButton
public boolean hasResetButton(String nameOrID)
- Specified by:
hasResetButton in interface ITestingEngine
hasTable
public boolean hasTable(String tableSummaryNameOrId)
- Specified by:
hasTable in interface ITestingEngine
hasWindow
public boolean hasWindow(String windowName)
- Specified by:
hasWindow in interface ITestingEngine
hasWindowByTitle
public boolean hasWindowByTitle(String title)
- Specified by:
hasWindowByTitle in interface ITestingEngine
isCheckboxSelected
public boolean isCheckboxSelected(String checkBoxName)
- Specified by:
isCheckboxSelected in interface ITestingEngine
isCheckboxSelected
public boolean isCheckboxSelected(String checkBoxName,
String checkBoxValue)
- Specified by:
isCheckboxSelected in interface ITestingEngine
isMatchInElement
public boolean isMatchInElement(String elementID,
String regexp)
- Specified by:
isMatchInElement in interface ITestingEngine
isTextInElement
public boolean isTextInElement(String elementID,
String text)
- Specified by:
isTextInElement in interface ITestingEngine
refresh
public void refresh()
reset
public void reset()
- Specified by:
reset in interface ITestingEngine
selectOptions
public void selectOptions(String selectName,
String[] optionsValue)
- Specified by:
selectOptions in interface ITestingEngine
selectOptions
public void selectOptions(String selectName,
int index,
String[] optionsValue)
- Specified by:
selectOptions in interface ITestingEngine
setScriptingEnabled
public void setScriptingEnabled(boolean value)
- Specified by:
setScriptingEnabled in interface ITestingEngine
setTextField
public void setTextField(String inputName,
String text)
- Specified by:
setTextField in interface ITestingEngine
setHiddenField
public void setHiddenField(String inputName,
String text)
- Specified by:
setHiddenField in interface ITestingEngine
setWorkingForm
public void setWorkingForm(String nameOrId,
int index)
- Specified by:
setWorkingForm in interface ITestingEngine
submit
public void submit()
- Specified by:
submit in interface ITestingEngine
submit
public void submit(String nameOrID,
String value)
- Specified by:
submit in interface ITestingEngine
submit
public void submit(String nameOrID)
- Specified by:
submit in interface ITestingEngine
uncheckCheckbox
public void uncheckCheckbox(String checkBoxName,
String value)
- Specified by:
uncheckCheckbox in interface ITestingEngine
uncheckCheckbox
public void uncheckCheckbox(String checkBoxName)
- Specified by:
uncheckCheckbox in interface ITestingEngine
unselectOptions
public void unselectOptions(String selectName,
String[] options)
- Specified by:
unselectOptions in interface ITestingEngine
unselectOptions
public void unselectOptions(String selectName,
int index,
String[] options)
- Specified by:
unselectOptions in interface ITestingEngine
getTestContext
public TestContext getTestContext()
setTestContext
public void setTestContext(TestContext testContext)
getTable
public Table getTable(String tableSummaryNameOrId)
- Specified by:
getTable in interface ITestingEngine
formSelector
protected String formSelector()
getWindowCount
public int getWindowCount()
- Specified by:
getWindowCount in interface ITestingEngine
gotoWindow
public void gotoWindow(int windowID)
- Specified by:
gotoWindow in interface ITestingEngine
getTextFieldValue
public String getTextFieldValue(String paramName)
- Specified by:
getTextFieldValue in interface ITestingEngine
getHiddenFieldValue
public String getHiddenFieldValue(String paramName)
- Specified by:
getHiddenFieldValue in interface ITestingEngine
getJavascriptAlert
public String getJavascriptAlert()
throws ElementNotFoundException
- Throws:
ElementNotFoundException
getElementAttributByXPath
public String getElementAttributByXPath(String xpath,
String attribut)
- Specified by:
getElementAttributByXPath in interface ITestingEngine
getElementTextByXPath
public String getElementTextByXPath(String xpath)
- Specified by:
getElementTextByXPath in interface ITestingEngine
getInputStream
public InputStream getInputStream()
- Specified by:
getInputStream in interface ITestingEngine
getInputStream
public InputStream getInputStream(URL url)
throws TestingEngineResponseException
- Specified by:
getInputStream in interface ITestingEngine
- Throws:
TestingEngineResponseException
getPageURL
public URL getPageURL()
- Specified by:
getPageURL in interface ITestingEngine
getSelectedRadio
public String getSelectedRadio(String radioGroup)
- Specified by:
getSelectedRadio in interface ITestingEngine
getRadioCount
protected int getRadioCount(String radioGroup)
setExpectedJavaScriptAlert
public void setExpectedJavaScriptAlert(JavascriptAlert[] alerts)
throws ExpectedJavascriptAlertException
- Specified by:
setExpectedJavaScriptAlert in interface ITestingEngine
- Throws:
ExpectedJavascriptAlertException
setExpectedJavaScriptConfirm
public void setExpectedJavaScriptConfirm(JavascriptConfirm[] confirms)
throws ExpectedJavascriptConfirmException
- Specified by:
setExpectedJavaScriptConfirm in interface ITestingEngine
- Throws:
ExpectedJavascriptConfirmException
setExpectedJavaScriptPrompt
public void setExpectedJavaScriptPrompt(JavascriptPrompt[] prompts)
throws ExpectedJavascriptPromptException
- Specified by:
setExpectedJavaScriptPrompt in interface ITestingEngine
- Throws:
ExpectedJavascriptPromptException
setWorkingForm
public void setWorkingForm(int index)
- Specified by:
setWorkingForm in interface ITestingEngine
Copyright © 2002-2008 SourceForge. All Rights Reserved.