com.atlassian.confluence.pageobjects.component.editor
Class EditorContent

java.lang.Object
  extended by com.atlassian.confluence.pageobjects.component.editor.EditorContent
Direct Known Subclasses:
CommentsSection.NewComment

public class EditorContent
extends java.lang.Object


Field Summary
protected  com.atlassian.pageobjects.PageBinder binder
           
protected  org.openqa.selenium.JavascriptExecutor client
           
protected  org.openqa.selenium.WebDriver driver
           
protected  ConfluenceFrameExecutor execute
           
protected  com.atlassian.pageobjects.elements.PageElementFinder page
           
protected  com.atlassian.pageobjects.elements.timeout.Timeouts timeouts
           
 
Constructor Summary
EditorContent()
           
 
Method Summary
 EditorContent clear()
           
 void clickInContent(org.openqa.selenium.By by)
           
 java.lang.String getCurrentSelectionText()
          Returns the text of the current editor selection.
 java.lang.String getHtml()
          Deprecated. use getTimedHtml()
 RenderedContent getRenderedContent()
          Returns a RenderedContent object which lets you easily access elements in the editor iframe without having to manually switch frames.
 com.atlassian.pageobjects.elements.query.TimedQuery<java.lang.String> getTimedHtml()
           
 com.atlassian.pageobjects.elements.query.TimedQuery hasLayout(PageLayout2Toolbar.PageLayoutSectionType sectionType)
           
 java.util.List<MacroPlaceholder> macroPlaceholderFor(java.lang.String macroName)
           
 void placeCursor(java.lang.String selector, int position)
          Positions the cursor at the specified position in the first matched element for the provided CSS selector.
 void placeCursorAtStart(java.lang.String selector)
          Positions the cursor at the start of the first matched element for the provided CSS selector.
 void putCursorAtStartOfElementWithSelectorAndIndex(java.lang.String selector, int elementIndex)
          Place the cursor at the start of the element matching the given selector and index.
 void putCursorAtStartOfFirstElementWithSelector(java.lang.String selector)
          Place the cursor at the start of the first element matching the given selector.
 void replaceCurrentSelectionText(java.lang.String text)
          Replaces the text of the current selection with the given text.
 void selectElementWithSelectorAndIndex(java.lang.String selector, int elementIndex)
           
 void selectFirstElementWithSelector(java.lang.String selector)
          Select the first element matching the given selector.
 void selectFirstParagraph()
           
 EditorContent setContent(java.lang.String content)
           
 void setContentInColumn(int column, java.lang.String content)
           
 void setContentViaJs(java.lang.String content)
          This sets the content of the editor using the TinyMCE api.
 EditorContent type(java.lang.String content)
          Type content in the editor.
protected  void typeIn(com.atlassian.pageobjects.elements.PageElement element, java.lang.String content)
          Currently uses sendKeys to the given element to type.
 void typeInColumn(int column, java.lang.String content)
          Type content in the given column index.
 void typeInFooter(java.lang.String content)
          Type content in the footer of a page layout.
 void typeInHeader(java.lang.String content)
          Type content in the header of a page layout.
 void waitForMacroBodyInColumn(int column, java.lang.String macroName)
          Wait for a macro with a body to be rendered inside a column
 void waitForTextContent(java.lang.String content)
          Waits until the given text is present in the editor content.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

execute

@Inject
protected ConfluenceFrameExecutor execute

binder

@Inject
protected com.atlassian.pageobjects.PageBinder binder

driver

@Inject
protected org.openqa.selenium.WebDriver driver

client

@Inject
protected org.openqa.selenium.JavascriptExecutor client

page

@Inject
protected com.atlassian.pageobjects.elements.PageElementFinder page

timeouts

@Inject
protected com.atlassian.pageobjects.elements.timeout.Timeouts timeouts
Constructor Detail

EditorContent

public EditorContent()
Method Detail

getRenderedContent

public RenderedContent getRenderedContent()
Returns a RenderedContent object which lets you easily access elements in the editor iframe without having to manually switch frames.


setContent

public EditorContent setContent(java.lang.String content)

setContentViaJs

public void setContentViaJs(java.lang.String content)
This sets the content of the editor using the TinyMCE api. It does not fire the correct key events and does not wait for the content to be present either. Use this method with care.

Parameters:
content - html content to be set in the editor

clear

public EditorContent clear()

type

public EditorContent type(java.lang.String content)
Type content in the editor. It assumes that no page layout has been applied.


typeInColumn

public void typeInColumn(int column,
                         java.lang.String content)
Type content in the given column index. It assumes that a column page layout has been applied. Note the column index is 1-based.


setContentInColumn

public void setContentInColumn(int column,
                               java.lang.String content)

waitForMacroBodyInColumn

public void waitForMacroBodyInColumn(int column,
                                     java.lang.String macroName)
Wait for a macro with a body to be rendered inside a column

Parameters:
column - The index of the column (1-based).
macroName - The name of the macro to wait for

waitForTextContent

public void waitForTextContent(java.lang.String content)
Waits until the given text is present in the editor content.


typeInHeader

public void typeInHeader(java.lang.String content)
Type content in the header of a page layout. It assumes a complex page layout has been applied.


typeInFooter

public void typeInFooter(java.lang.String content)
Type content in the footer of a page layout. It assumes a complex page layout has been applied.


typeIn

protected void typeIn(com.atlassian.pageobjects.elements.PageElement element,
                      java.lang.String content)
Currently uses sendKeys to the given element to type. This needs to be rewritten so it works for all the browsers.


getHtml

@Deprecated
public java.lang.String getHtml()
Deprecated. use getTimedHtml()

Returns the current content of the Editor as HTML.


getTimedHtml

public com.atlassian.pageobjects.elements.query.TimedQuery<java.lang.String> getTimedHtml()

selectFirstParagraph

public void selectFirstParagraph()

selectFirstElementWithSelector

public void selectFirstElementWithSelector(java.lang.String selector)
Select the first element matching the given selector.


selectElementWithSelectorAndIndex

public void selectElementWithSelectorAndIndex(java.lang.String selector,
                                              int elementIndex)

placeCursorAtStart

public void placeCursorAtStart(java.lang.String selector)
Positions the cursor at the start of the first matched element for the provided CSS selector.


placeCursor

public void placeCursor(java.lang.String selector,
                        int position)
Positions the cursor at the specified position in the first matched element for the provided CSS selector. Doesn't work for IE very well.


putCursorAtStartOfElementWithSelectorAndIndex

public void putCursorAtStartOfElementWithSelectorAndIndex(java.lang.String selector,
                                                          int elementIndex)
Place the cursor at the start of the element matching the given selector and index. Seems to work in Firefox & IE, although the moxiecode docs indicate that the 'true' second parameter doesn't do anything in IE. If this method turns out to be consistent we could refactor putCursorAtStartOfFirstElementWithSelector(String) into it.

Parameters:
selector - see tiny_mce_src.DOMUtils.select
elementIndex - index of matched element to select, 0-indexed

putCursorAtStartOfFirstElementWithSelector

public void putCursorAtStartOfFirstElementWithSelector(java.lang.String selector)
Place the cursor at the start of the first element matching the given selector.

Parameters:
selector - see tiny_mce_src.DOMUtils.select

getCurrentSelectionText

public java.lang.String getCurrentSelectionText()
Returns the text of the current editor selection.


replaceCurrentSelectionText

public void replaceCurrentSelectionText(java.lang.String text)
Replaces the text of the current selection with the given text.

Parameters:
text - the text to replace the current selection with

macroPlaceholderFor

public java.util.List<MacroPlaceholder> macroPlaceholderFor(java.lang.String macroName)

clickInContent

public void clickInContent(org.openqa.selenium.By by)

hasLayout

public com.atlassian.pageobjects.elements.query.TimedQuery hasLayout(PageLayout2Toolbar.PageLayoutSectionType sectionType)


Copyright © 2003-2013 Atlassian. All Rights Reserved.