diff options
author | Teemu Suo-Anttila <teemusa@vaadin.com> | 2014-01-13 17:03:01 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2014-01-16 11:14:29 +0000 |
commit | 168788959373f561b8862128fa6aedc20a5591c2 (patch) | |
tree | 58029d9784218cd3c0dcf30a72366b4fe45d5cdd /uitest/src/com/vaadin/tests/tb3 | |
parent | b9a6a48ab6ce9e3c7d8d025520e866643d19c004 (diff) | |
download | vaadin-framework-168788959373f561b8862128fa6aedc20a5591c2.tar.gz vaadin-framework-168788959373f561b8862128fa6aedc20a5591c2.zip |
Retain focus while changing DOM in OrderedLayout (#12967)
Change-Id: Id25177a2dfecc2d0d3b8bb5803656a39bec9c5d6
Diffstat (limited to 'uitest/src/com/vaadin/tests/tb3')
-rw-r--r-- | uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java index 7a214bd60c..55a2b80918 100644 --- a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java +++ b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java @@ -28,6 +28,7 @@ import org.junit.After; import org.junit.Before; import org.junit.runner.RunWith; import org.openqa.selenium.By; +import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.Platform; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; @@ -278,6 +279,21 @@ public abstract class AbstractTB3Test extends TestBenchTestCase { } /** + * Uses JavaScript to determine the currently focused element. + * + * @return Focused element or null + */ + protected WebElement getFocusedElement() { + Object focusedElement = ((JavascriptExecutor) getDriver()) + .executeScript("return document.activeElement"); + if (null != focusedElement) { + return (WebElement) focusedElement; + } else { + return null; + } + } + + /** * Find a Vaadin element based on its id given using Component.setId * * @param id |