diff --git a/vaadin-testbench-core/src/main/java/com/vaadin/testbench/TestBenchElement.java b/vaadin-testbench-core/src/main/java/com/vaadin/testbench/TestBenchElement.java index 8068ab309..c454e539f 100644 --- a/vaadin-testbench-core/src/main/java/com/vaadin/testbench/TestBenchElement.java +++ b/vaadin-testbench-core/src/main/java/com/vaadin/testbench/TestBenchElement.java @@ -167,8 +167,7 @@ public void waitForVaadin() { @Override public void showTooltip() { waitForVaadin(); - new Actions(getCommandExecutor().getWrappedDriver()) - .moveToElement(actualElement).perform(); + new Actions(getDriver()).moveToElement(actualElement).perform(); // Wait for a small moment for the tooltip to appear try { Thread.sleep(1000); // VTooltip.OPEN_DELAY = 750; @@ -331,7 +330,7 @@ public String getCssValue(String propertyName) { public void click(int x, int y, Keys... modifiers) { autoScrollIntoView(); waitForVaadin(); - Actions actions = new Actions(getCommandExecutor().getWrappedDriver()); + Actions actions = new Actions(getDriver()); actions.moveToElement(actualElement, x, y); // Press any modifier keys for (Keys modifier : modifiers) { @@ -374,7 +373,7 @@ public TestBenchCommandExecutor getCommandExecutor() { @Override public WebDriver getDriver() { - return getCommandExecutor().getWrappedDriver(); + return getCommandExecutor().getDriver(); } /** @@ -537,7 +536,7 @@ private void autoScrollIntoView() { *
* Use e.g. as
*
* Use e.g. as
* waitUntil(ExpectedConditions.presenceOfElementLocated(by), 10);
- *
+ *
* @param condition
* Models a condition that might reasonably be expected to
* eventually evaluate to something that is neither null nor
@@ -546,10 +545,10 @@ private void autoScrollIntoView() {
* The timeout in seconds for the wait.
* @return The condition's return value if it returned something different
* from null or false before the timeout expired.
- *
+ *
* @throws TimeoutException
* If the timeout expires.
- *
+ *
* @see FluentWait#until
* @see ExpectedCondition
*/
@@ -565,17 +564,17 @@ protected waitUntil(ExpectedConditions.presenceOfElementLocated(by));
- *
+ *
* @param condition
* Models a condition that might reasonably be expected to
* eventually evaluate to something that is neither null nor
* false.
* @return The condition's return value if it returned something different
* from null or false before the timeout expired.
- *
+ *
* @throws TimeoutException
* If 10 seconds passed.
- *
+ *
* @see FluentWait#until
* @see ExpectedCondition
*/
diff --git a/vaadin-testbench-core/src/main/java/com/vaadin/testbench/commands/TestBenchCommandExecutor.java b/vaadin-testbench-core/src/main/java/com/vaadin/testbench/commands/TestBenchCommandExecutor.java
index 0b1472080..cdee45304 100644
--- a/vaadin-testbench-core/src/main/java/com/vaadin/testbench/commands/TestBenchCommandExecutor.java
+++ b/vaadin-testbench-core/src/main/java/com/vaadin/testbench/commands/TestBenchCommandExecutor.java
@@ -125,7 +125,7 @@ public void waitForVaadin() {
@Override
public boolean compareScreen(String referenceId) throws IOException {
- WebDriver driver = getWrappedDriver();
+ WebDriver driver = getDriver();
return ScreenshotComparator.compareScreen(referenceId,
referenceNameGenerator, imageComparison,
(TakesScreenshot) driver, (HasCapabilities) driver);
@@ -265,6 +265,19 @@ public WebDriver getWrappedDriver() {
return actualDriver;
}
+ /**
+ * Return a reference to the {@link WebDriver} instance associated with this
+ * {@link TestBenchCommandExecutor}
+ *
+ * @return a WebDriver instance
+ */
+ public WebDriver getDriver() {
+ // This is actually never called. The overridden version in
+ // TestBenchDriverProy is. This class hierarchy is wrong in several
+ // ways.
+ return actualDriver;
+ }
+
@Override
public void resizeViewPortTo(final int desiredWidth,
final int desiredHeight) throws UnsupportedOperationException {