我在c#中使用硒web驅動程序。 當我用JavaScript方法寫本地存儲時,它工作正常 (我可以看到HTML頁面中的值與檢查),但如果我嘗試從本地存儲讀取我剛剛寫它返回空。 感謝您的幫助。閱讀html 5本地存儲與硒
寫作(作品):
IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
js.ExecuteScript("localStorage.setItem('key','value');");
閱讀(返回null):
Object Value= js.ExecuteScript("localStorage.getItem('key')");
硒API有一個'local_storage'端點:https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/local_storage –