Example usage for org.openqa.selenium Keys F5

List of usage examples for org.openqa.selenium Keys F5

Introduction

In this page you can find the example usage for org.openqa.selenium Keys F5.

Prototype

Keys F5

To view the source code for org.openqa.selenium Keys F5.

Click Source Link

Usage

From source file:org.xwiki.wysiwyg.test.ui.EditWYSIWYGTest.java

License:Open Source License

/**
 * Tests that the currently active editor (WYSIWYG or Source) is preserved when the user refreshes the page.
 *//*from   w  w w  .  ja  va  2  s .c o  m*/
@Test
@IgnoreBrowsers({
        @IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See http://jira.xwiki.org/browse/XE-1146"),
        @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See http://jira.xwiki.org/browse/XE-1177") })
public void testPreserveSelectedEditorAgainstRefresh() {
    // The WYSIWYG editor should be initially active.
    EditorElement editor = this.editPage.getContentEditor();
    Assert.assertFalse(editor.getSourceTextArea().isEnabled());

    // Switch to Source editor and refresh the page.
    editor.switchToSource();
    editor.getSourceTextArea().sendKeys(Keys.F5);

    this.editPage = new WYSIWYGEditPage();
    editor = this.editPage.getContentEditor();
    editor.waitToLoad();

    // The Source editor should be active now because it was selected before the refresh.
    Assert.assertTrue(editor.getSourceTextArea().isEnabled());

    // Switch to WYSIWYG editor and refresh the page again.
    editor.switchToWysiwyg();
    this.editPage.sendKeys(Keys.F5);

    this.editPage = new WYSIWYGEditPage();
    editor = this.editPage.getContentEditor();
    editor.waitToLoad();

    // The WYSIWYG editor should be active now because it was selected before the refresh.
    Assert.assertFalse(editor.getSourceTextArea().isEnabled());
}