mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-14 22:43:57 +00:00
Bug 4339: Using Selenium WebStorage to clear local storage if available
This commit is contained in:
1 parent
7648b69fe5
commit
69e867bb9b
1 file changed
+8
-1
+8
-1
@@ -23,6 +23,7 @@ import org.openqa.selenium.JavascriptExecutor;
|
||||
import org.openqa.selenium.OutputType;
|
||||
import org.openqa.selenium.TakesScreenshot;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.html5.WebStorage;
|
||||
import org.openqa.selenium.remote.Augmenter;
|
||||
import org.openqa.selenium.remote.RemoteWebDriver;
|
||||
|
||||
@@ -85,7 +86,13 @@ public abstract class AbstractSeleniumTest {
|
||||
}
|
||||
// clear local storage
|
||||
getWebDriver().get(contextRoot);
|
||||
((JavascriptExecutor)getWebDriver()).executeScript("window.localStorage.clear();");
|
||||
// TODO get to know if all of our used drivers support WebStorage and if yes, remove the old JS solution
|
||||
if (getWebDriver() instanceof WebStorage) {
|
||||
final WebStorage webStorage = (WebStorage)getWebDriver();
|
||||
webStorage.getLocalStorage().clear();
|
||||
} else {
|
||||
((JavascriptExecutor)getWebDriver()).executeScript("window.localStorage.clear();");
|
||||
}
|
||||
}
|
||||
|
||||
protected void setUpAuthenticatedSession() {
|
||||
|
||||
Reference in new issue
Block a user