Java 类org.openqa.selenium.html5.LocalStorage 实例源码
项目:phoenix.webui.framework
文件:AutoModuleProxy.java
private void saveLocalStorage(String account)
{
WebDriver driver = util.getEngine().getDriver();
if(driver instanceof WebStorage)
{
WebStorage webStorage = (WebStorage) driver;
LocalStorage localStorage = webStorage.getLocalStorage();
Properties pro = new Properties();
for(String key : localStorage.keySet())
{
pro.setProperty(key, localStorage.getItem(key));
}
PathUtil.proStore(pro, "localStorage." + account);
}
}
项目:phoenix.webui.framework
文件:AutoModuleProxy.java
private boolean loadLocalStorage(String accountNameValue, Map<String, String> customMap)
{
WebDriver webDriver = util.getEngine().getDriver();
if(webDriver instanceof WebStorage)
{
WebStorage webStorage = (WebStorage) webDriver;
LocalStorage localStorage = webStorage.getLocalStorage();
Properties pro = new Properties();
if(PathUtil.proLoad(pro, "localStorage." + accountNameValue))
{
if(pro.isEmpty())
{
return false;
}
pro.putAll(customMap);
pro.stringPropertyNames().parallelStream().forEach((key) -> {
localStorage.setItem(key, pro.getProperty(key));
});
return true;
}
}
return false;
}
项目:Java-Testing-Toolbox
文件:JSWebStorage.java
@Override
public LocalStorage getLocalStorage() {
return new JSLocalStorage(this.getDriverContext());
}
项目:automationAbstractions
文件:LocalStorageTest.java
@Test
public void updatesLocalStorageInitiallyUglyCode(){
// initially code for backbone
// the spec is loosely interpreted by different frameworks
// so this will not be generic
// todos-[framework]
String storage_namespace = "todos-" + todoMVCSite.getName();
LocalStorage storage = new Storage((JavascriptExecutor)driver);
int initialSize = 0;
String[] keys;
try{
keys = storage.getItem(storage_namespace).split(",");
initialSize = keys.length;
}catch(NullPointerException e){
// the key might not exist
}
todoMVC.enterNewToDo("First Added Item");
keys = storage.getItem(storage_namespace).split(",");
int newSize = keys.length;
assertThat(newSize, greaterThan(initialSize));
boolean foundit = false;
// has title
keys = storage.getItem(storage_namespace).split(",");
for(String key : keys){
String itemKey = storage_namespace + "-" + key;
String item = storage.getItem(itemKey);
// should really parse json
if(item.contains("\"" + "First Added Item" + "\""))
foundit = true;
}
assertThat(foundit, is(true));
}
项目:domui
文件:MyChromeDriver.java
@Override
public LocalStorage getLocalStorage() {
return this.webStorage.getLocalStorage();
}