Comment #5 on issue 7357 by barancev: WebElement.sendKeys fails when
I can't reproduce the issue. Here is the code:
RemoteWebDriver driver = new
RemoteWebDriver(DesiredCapabilities.firefox());
driver.get("
http://ckeditor.com/demo");
driver.switchTo().frame(driver.findElement(By.className("cke_wysiwyg_frame")));
WebElement contents = driver.findElement(By.tagName("body"));
int charsToDelete = contents.getText().length();
Actions actions = new Actions(driver);
CharSequence[] deleteKeys = new CharSequence[charsToDelete];
Arrays.fill(deleteKeys, Keys.BACK_SPACE);
actions.sendKeys(contents, deleteKeys).perform();
Arrays.fill(deleteKeys, Keys.DELETE);
actions.sendKeys(contents, deleteKeys).perform();
driver.quit();
And the server log:
03:08:01.607 INFO - Done: [new session: Capabilities [{platform=ANY,
browserName
=firefox, version=}]]
03:08:01.626 INFO - Executing: [get:
http://ckeditor.com/demo])
03:08:04.607 INFO - Done: [get:
http://ckeditor.com/demo]
03:08:04.615 INFO - Executing: [find element: By.className:
cke_wysiwyg_frame])
03:08:04.692 INFO - Done: [find element: By.className: cke_wysiwyg_frame]
03:08:04.698 INFO - Executing: [switch to frame: [[FirefoxDriver: firefox
on WIN
DOWS (ab82f24c-8a9f-4457-b5fc-70132a81c460)] -> class name:
cke_wysiwyg_frame]])
03:08:04.749 INFO - Done: [switch to frame: [[FirefoxDriver: firefox on
WINDOWS
(ab82f24c-8a9f-4457-b5fc-70132a81c460)] -> class name: cke_wysiwyg_frame]]
03:08:04.753 INFO - Executing: [find element: By.tagName: body])
03:08:04.805 INFO - Done: [find element: By.tagName: body]
03:08:04.809 INFO - Executing: [get text: 1 [[FirefoxDriver: firefox on
WINDOWS
(ab82f24c-8a9f-4457-b5fc-70132a81c460)] -> tag name: body]])
03:08:04.886 INFO - Done: [get text: 1 [[FirefoxDriver: firefox on WINDOWS
(ab82
f24c-8a9f-4457-b5fc-70132a81c460)] -> tag name: body]]
03:08:04.894 INFO - Executing: [mousemove: 1 false])
03:08:04.945 INFO - Done: [mousemove: 1 false]
03:08:04.949 INFO - Executing: [click: nothing])
03:08:05.028 INFO - Done: [click: nothing]
03:08:05.046 INFO - Executing: [send keys to active: ?])
03:08:07.852 INFO - Done: [send keys to active: ?]
03:08:07.856 INFO - Executing: [mousemove: 1 false])
03:08:07.907 INFO - Done: [mousemove: 1 false]
03:08:07.910 INFO - Executing: [click: nothing])
03:08:07.962 INFO - Done: [click: nothing]
03:08:07.975 INFO - Executing: [send keys to active: ?])
03:08:10.855 INFO - Done: [send keys to active: ?]
03:08:10.859 INFO - Executing: [delete session:
c5bdc1af-a7ca-46bd-ba0a-b0866210
e83d])
03:08:12.911 INFO - Command failed to close cleanly. Destroying forcefully
(v2).
org.openqa.selenium.os.UnixProcess$SeleniumWatchDog@6121237b
03:08:13.787 INFO - Done: [delete session:
c5bdc1af-a7ca-46bd-ba0a-b0866210e83d]
Yes, it does not clean the editor window. But contents.clear() does work as
expected.
Also actions.sendKeys(contents, Keys.CONTROL + "ax").perform() does the
trick.
But the main problem is that I can't reproduce the issue.