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

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

public class EditorContent
extends 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
 EditorAutocompleteMacro autocompleteMacro(String content)
           
 EditorContent clear()
           
 MacroForm clickEditInlineMacro(String macroName)
          Click on the macro, than wait for the property panel to appear and click edit
 void clickInContent(org.openqa.selenium.By by)
           
 EditorContent clickOnInlinetask(String listItemSelector)
          Inline-task-list only have a small portion of the list item that can be clicked in order to toggle the checked state.
 MacroForm doubleClickEditInlineMacro(String macroName)
          Double click on the macro to trigger edit mode
 MacroForm doubleClickEditWysiwygMacro(String macroName)
           
 void doubleClickInContent(org.openqa.selenium.By by)
           
 com.atlassian.pageobjects.elements.query.TimedQuery<Integer> elementSelectionNumberOfMatches(org.openqa.selenium.By selection)
          Returns the number of matches for a particular selector query within the editor content
 EditorContent focus()
           
 com.atlassian.pageobjects.elements.query.TimedQuery<String> getAttributeInSelection(org.openqa.selenium.By selection, String attr)
          Returns the value of the attribute of the selection
 String getClassNameOfCurrentCursor()
           
 com.atlassian.pageobjects.elements.query.TimedQuery<org.openqa.selenium.Dimension> getContainerSize()
          Returns editor size
 com.atlassian.pageobjects.elements.query.TimedQuery<String> getCurrentSearchMatchText()
           
 String getCurrentSelectionText()
          Returns the text of the current editor selection.
 com.atlassian.pageobjects.elements.query.TimedQuery<String> getCurrentSelectionTextTimed()
          Returns a timed query for getting the current editor selection.
 List<EditorEmbeddedImage> getEmbeddedImages()
           
 List<EditorEmbeddedLink> getEmbededLinks()
           
 String getHtml()
          Deprecated. Since 5.4 use getTimedHtml()
 com.atlassian.pageobjects.elements.query.TimedQuery<Integer> getImageHeight(Attachment image)
          Deprecated. since 5.7 use `getEmbeddedImages` to get EditorEmbeddedImage then use EditorEmbeddedImage.getHeight()
 com.atlassian.pageobjects.elements.query.TimedQuery<Integer> getImageWidth(Attachment image)
          Deprecated. since 5.7 use `getEmbeddedImages` to get EditorEmbeddedImage then use EditorEmbeddedImage.getWidth()
 String getInnerHTMLOfCurrentCursorPosition()
          Returns the innerHTML value of the node that the cursor is currently positioned in.
 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<String> getSelectorParentText(String selector)
          Returns the parent PageElement of a selector
 com.atlassian.pageobjects.elements.query.TimedQuery<String> getTextInSelection(org.openqa.selenium.By selection)
          Returns text contained in the provided selection within the editor content
 com.atlassian.pageobjects.elements.query.TimedQuery<String> getTimedHtml()
           
 com.atlassian.pageobjects.elements.query.TimedQuery<String> getTimedNormalizedHtml(boolean normalizeSpaces)
           
 com.atlassian.pageobjects.elements.query.TimedQuery<Boolean> hasInlineMacro(String macroName, List<String> macroParameters)
          Check if inline macro is existed on editor panel or not
 com.atlassian.pageobjects.elements.query.TimedCondition hasLayout(PageLayout2Toolbar.PageLayoutSectionType sectionType)
           
 com.atlassian.pageobjects.elements.query.TimedQuery<Boolean> hasMacro(String macroName, List<String> macroParameters)
          Check if non-inline macro exists in editor panel or not
 com.atlassian.pageobjects.elements.query.TimedQuery<Boolean> hasMacroPlaceholder(String macroName)
           
 com.atlassian.pageobjects.elements.query.TimedQuery<Boolean> hasPageLinkWithExplicitSpaceKey(String spaceKey, String pageTitle)
           
 com.atlassian.pageobjects.elements.query.TimedCondition htmlContains(String markup)
           
 com.atlassian.pageobjects.elements.query.TimedQuery<Boolean> isContentVisible()
           
 com.atlassian.pageobjects.elements.query.TimedQuery<Boolean> isElementPresentInEditorContentTimed(org.openqa.selenium.By selection)
          Returns if certain selection is matched on the editor content
 com.atlassian.pageobjects.elements.query.TimedCondition isImagePresent(Attachment attachment)
           
 com.atlassian.pageobjects.elements.query.TimedCondition isImagePresentBySrc(Attachment attachment)
           
 com.atlassian.pageobjects.elements.query.TimedCondition isVisble(org.openqa.selenium.By by)
          Deprecated. since 5.5.1 use isPresent
 com.atlassian.pageobjects.elements.query.TimedCondition isVisible(org.openqa.selenium.By by)
          Check if the editor content has a certain element
 List<MacroPlaceholder> macroPlaceholderFor(String macroName)
           
 MentionsMenu mentionsAutocomplete(String content)
           
 com.atlassian.pageobjects.elements.query.TimedCondition normalizedHtmlContains(String normalizedHtml, boolean normalizeSpaces)
           
 String normalizeHtml(String html, boolean normalizeSpaces)
           
 void pasteContent(String html)
          Pastes the content as though it came from the clipboard.
 void placeCursor(String selector, int position)
          Positions the cursor at the specified position in the first matched element for the provided CSS selector.
 void placeCursorAtEnd(String selector)
          Positions the cursor at the end of the first matched element for the provided CSS selector.
 void placeCursorAtStart(String selector)
          Positions the cursor at the start of the first matched element for the provided CSS selector.
 void putCursorAtEndOfFirstElementWithSelector(String selector)
          Place the cursor at the end of the first element matching the given selector.
 void putCursorAtStartOfElementWithSelectorAndIndex(String selector, int elementIndex)
          Place the cursor at the start of the element matching the given selector and index.
 void putCursorAtStartOfFirstElementWithSelector(String selector)
          Place the cursor at the start of the first element matching the given selector.
 void redo()
          Execute Redo command in editor
 void replaceCurrentSelectionChildContent(String text)
           
 void replaceCurrentSelectionChildContentWithHtml(String html)
           
 void replaceCurrentSelectionText(String text)
          Replaces the text of the current selection with the given text.
 void select(String startArgs, String endArgs)
           
 void selectElementWithSelectorAndIndex(String selector, int elementIndex)
           
 void selectFirstElementWithSelector(String selector)
          Select the first element matching the given selector.
 void selectFirstParagraph()
           
 void sendKeys(String keys)
           
 EditorContent setContent(String content)
           
 void setContentInColumn(int column, String content)
          Set content in the given column index.
 void setContentViaJs(String content)
          This sets the content of the editor using the TinyMCE api.
 EditorContent type(String content)
          Type content in the editor.
protected  void typeIn(com.atlassian.pageobjects.elements.PageElement element, String content)
          Currently uses sendKeys to the given element to type.
 void typeInColumn(int column, String content)
          Type content in the given column index.
 EditorContent typeWithoutLosingFocus(CharSequence... content)
          Type content in the editor and do not lose focus
 void undo()
          Execute Undo command in editor
 void waitForInlineMacro(String macroName)
          Wait for a macro without a body to be rendered.
 void waitForInlineMacroWithDefaultParameter(String macroName, String defaultParameter)
          Wait for a macro with a default parameter to be rendered.
 void waitForInlineMacroWithParameters(String macroName, String parameters)
          Wait for a macro with parameters to be rendered.
 void waitForMacro(String macroName)
          Wait for a non-inline macro to be rendered.
 void waitForMacroBody(String macroName, String body)
          Wait for a macro with a body to be rendered
 void waitForMacroBodyInColumn(int column, String macroName)
          Wait for a macro with a body to be rendered inside a column
 void waitForMacroWithParameters(String macroName, List<String> parameters)
          Wait for a non-inline macro with parameters to be rendered.
 void waitForTextContent(String content)
          Waits until the given text is present in the editor content.
 void waitUntilMetaDataIsPopulated()
          Wait's until the meta data list for the macro browser is populated and then switches the frame back to tinymce
 
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.


isContentVisible

public com.atlassian.pageobjects.elements.query.TimedQuery<Boolean> isContentVisible()

getContainerSize

public com.atlassian.pageobjects.elements.query.TimedQuery<org.openqa.selenium.Dimension> getContainerSize()
Returns editor size

Since:
5.6

setContent

public EditorContent setContent(String content)

setContentViaJs

public void setContentViaJs(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()

typeWithoutLosingFocus

public EditorContent typeWithoutLosingFocus(CharSequence... content)
Type content in the editor and do not lose focus


clickOnInlinetask

public EditorContent clickOnInlinetask(String listItemSelector)
Inline-task-list only have a small portion of the list item that can be clicked in order to toggle the checked state.


focus

public EditorContent focus()

type

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


typeInColumn

public void typeInColumn(int column,
                         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,
                               String content)
Set content in the given column index. It assumes that a column page layout has been applied. Note the column index is 1-based.

Parameters:
column - column index (1-based)
content - string to be set as content.

clickEditInlineMacro

public MacroForm clickEditInlineMacro(String macroName)
Click on the macro, than wait for the property panel to appear and click edit

Parameters:
macroName - The name of the macro to wait for

doubleClickEditInlineMacro

public MacroForm doubleClickEditInlineMacro(String macroName)
Double click on the macro to trigger edit mode

Parameters:
macroName - The name of the macro to wait for

doubleClickEditWysiwygMacro

public MacroForm doubleClickEditWysiwygMacro(String macroName)

waitForInlineMacro

public void waitForInlineMacro(String macroName)
Wait for a macro without a body to be rendered.

Parameters:
macroName - The name of the macro to wait for

waitForInlineMacroWithDefaultParameter

public void waitForInlineMacroWithDefaultParameter(String macroName,
                                                   String defaultParameter)
Wait for a macro with a default parameter to be rendered.

Parameters:
macroName -
defaultParameter -

waitForInlineMacroWithParameters

public void waitForInlineMacroWithParameters(String macroName,
                                             String parameters)
Wait for a macro with parameters to be rendered.

Parameters:
macroName -
parameters -

waitForMacro

public void waitForMacro(String macroName)
Wait for a non-inline macro to be rendered.

Parameters:
macroName - The name of the macro to wait for

waitForMacroWithParameters

public void waitForMacroWithParameters(String macroName,
                                       List<String> parameters)
Wait for a non-inline macro with parameters to be rendered.

Parameters:
macroName -
parameters -

waitForMacroBodyInColumn

public void waitForMacroBodyInColumn(int column,
                                     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

waitForMacroBody

public void waitForMacroBody(String macroName,
                             String body)
Wait for a macro with a body to be rendered

Parameters:
macroName -
body -

waitForTextContent

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


sendKeys

public void sendKeys(String keys)

typeIn

protected void typeIn(com.atlassian.pageobjects.elements.PageElement element,
                      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 String getHtml()
Deprecated. Since 5.4 use getTimedHtml()

Returns the current content of the Editor as HTML.


htmlContains

public com.atlassian.pageobjects.elements.query.TimedCondition htmlContains(String markup)
Since:
5.6

getTimedHtml

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

getTimedNormalizedHtml

public com.atlassian.pageobjects.elements.query.TimedQuery<String> getTimedNormalizedHtml(boolean normalizeSpaces)
Since:
5.6

normalizedHtmlContains

public com.atlassian.pageobjects.elements.query.TimedCondition normalizedHtmlContains(String normalizedHtml,
                                                                                      boolean normalizeSpaces)
Since:
5.6

normalizeHtml

public String normalizeHtml(String html,
                            boolean normalizeSpaces)
Since:
5.6

selectFirstParagraph

public void selectFirstParagraph()

selectFirstElementWithSelector

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


selectElementWithSelectorAndIndex

public void selectElementWithSelectorAndIndex(String selector,
                                              int elementIndex)

select

public void select(String startArgs,
                   String endArgs)

placeCursorAtStart

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


placeCursorAtEnd

public void placeCursorAtEnd(String selector)
Positions the cursor at the end of the first matched element for the provided CSS selector.


placeCursor

public void placeCursor(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(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(String selector)
Place the cursor at the start of the first element matching the given selector.

Parameters:
selector - see tiny_mce_src.DOMUtils.select

putCursorAtEndOfFirstElementWithSelector

public void putCursorAtEndOfFirstElementWithSelector(String selector)
Place the cursor at the end of the first element matching the given selector.

Parameters:
selector - see tiny_mce_src.DOMUtils.select

getInnerHTMLOfCurrentCursorPosition

public String getInnerHTMLOfCurrentCursorPosition()
Returns the innerHTML value of the node that the cursor is currently positioned in.


getClassNameOfCurrentCursor

public String getClassNameOfCurrentCursor()

getCurrentSelectionText

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


getSelectorParentText

public com.atlassian.pageobjects.elements.query.TimedQuery<String> getSelectorParentText(String selector)
Returns the parent PageElement of a selector


getCurrentSelectionTextTimed

public com.atlassian.pageobjects.elements.query.TimedQuery<String> getCurrentSelectionTextTimed()
Returns a timed query for getting the current editor selection.


isElementPresentInEditorContentTimed

public com.atlassian.pageobjects.elements.query.TimedQuery<Boolean> isElementPresentInEditorContentTimed(org.openqa.selenium.By selection)
Returns if certain selection is matched on the editor content


elementSelectionNumberOfMatches

public com.atlassian.pageobjects.elements.query.TimedQuery<Integer> elementSelectionNumberOfMatches(org.openqa.selenium.By selection)
Returns the number of matches for a particular selector query within the editor content


getTextInSelection

public com.atlassian.pageobjects.elements.query.TimedQuery<String> getTextInSelection(org.openqa.selenium.By selection)
Returns text contained in the provided selection within the editor content


getAttributeInSelection

public com.atlassian.pageobjects.elements.query.TimedQuery<String> getAttributeInSelection(org.openqa.selenium.By selection,
                                                                                           String attr)
Returns the value of the attribute of the selection


replaceCurrentSelectionText

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

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

replaceCurrentSelectionChildContent

public void replaceCurrentSelectionChildContent(String text)

replaceCurrentSelectionChildContentWithHtml

public void replaceCurrentSelectionChildContentWithHtml(String html)

hasMacroPlaceholder

public com.atlassian.pageobjects.elements.query.TimedQuery<Boolean> hasMacroPlaceholder(String macroName)

getEmbeddedImages

public List<EditorEmbeddedImage> getEmbeddedImages()

macroPlaceholderFor

public List<MacroPlaceholder> macroPlaceholderFor(String macroName)

getCurrentSearchMatchText

public com.atlassian.pageobjects.elements.query.TimedQuery<String> getCurrentSearchMatchText()

clickInContent

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

doubleClickInContent

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

isVisble

@Deprecated
public com.atlassian.pageobjects.elements.query.TimedCondition isVisble(org.openqa.selenium.By by)
Deprecated. since 5.5.1 use isPresent


isVisible

public com.atlassian.pageobjects.elements.query.TimedCondition isVisible(org.openqa.selenium.By by)
Check if the editor content has a certain element

Since:
5.6

isImagePresent

public com.atlassian.pageobjects.elements.query.TimedCondition isImagePresent(Attachment attachment)

isImagePresentBySrc

public com.atlassian.pageobjects.elements.query.TimedCondition isImagePresentBySrc(Attachment attachment)

getImageHeight

public com.atlassian.pageobjects.elements.query.TimedQuery<Integer> getImageHeight(Attachment image)
Deprecated. since 5.7 use `getEmbeddedImages` to get EditorEmbeddedImage then use EditorEmbeddedImage.getHeight()


getImageWidth

public com.atlassian.pageobjects.elements.query.TimedQuery<Integer> getImageWidth(Attachment image)
Deprecated. since 5.7 use `getEmbeddedImages` to get EditorEmbeddedImage then use EditorEmbeddedImage.getWidth()


hasLayout

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

autocompleteMacro

public EditorAutocompleteMacro autocompleteMacro(String content)

waitUntilMetaDataIsPopulated

public void waitUntilMetaDataIsPopulated()
Wait's until the meta data list for the macro browser is populated and then switches the frame back to tinymce

Since:
5.6

mentionsAutocomplete

public MentionsMenu mentionsAutocomplete(String content)

hasInlineMacro

public com.atlassian.pageobjects.elements.query.TimedQuery<Boolean> hasInlineMacro(String macroName,
                                                                                   List<String> macroParameters)
Check if inline macro is existed on editor panel or not

Parameters:
macroName -
macroParameters -
Returns:

hasMacro

public com.atlassian.pageobjects.elements.query.TimedQuery<Boolean> hasMacro(String macroName,
                                                                             List<String> macroParameters)
Check if non-inline macro exists in editor panel or not

Parameters:
macroName -
macroParameters -
Returns:

hasPageLinkWithExplicitSpaceKey

public com.atlassian.pageobjects.elements.query.TimedQuery<Boolean> hasPageLinkWithExplicitSpaceKey(String spaceKey,
                                                                                                    String pageTitle)

undo

public void undo()
Execute Undo command in editor


redo

public void redo()
Execute Redo command in editor


pasteContent

public void pasteContent(String html)
Pastes the content as though it came from the clipboard.

Parameters:
html -

getEmbededLinks

public List<EditorEmbeddedLink> getEmbededLinks()
Returns:
a list of links in the current editor. There is no guarenteed ordering, and may not appear in page order.
Since:
5.7


Copyright © 2003–2015 Atlassian. All rights reserved.