matrei commented on code in PR #285:
URL: https://github.com/apache/groovy-geb/pull/285#discussion_r2369905170
##########
module/geb-core/src/main/groovy/geb/webstorage/LocalStorage.groovy:
##########
@@ -18,49 +18,50 @@
*/
package geb.webstorage
-import org.openqa.selenium.html5.WebStorage as SeleniumWebStorage
-import org.openqa.selenium.html5.LocalStorage as SeleniumLocalStorage
+import geb.js.JavascriptInterface
class LocalStorage implements WebStorage {
- private final SeleniumWebStorage webStorage
+ private final JavascriptInterface js
- LocalStorage(SeleniumWebStorage webStorage) {
- this.webStorage = webStorage
+ LocalStorage(JavascriptInterface js) {
+ this.js = js
}
@Override
String getAt(String key) {
- localStorage.getItem(key)
+ js.exec(key, 'return window.localStorage.getItem(arguments[0]);')
}
@Override
void putAt(String key, String value) {
- localStorage.setItem(key, value)
+ js.exec(key, value, 'window.localStorage.setItem(arguments[0],
arguments[1]);')
}
@Override
void remove(String key) {
- localStorage.removeItem(key)
+ js.exec(key, 'window.localStorage.removeItem(arguments[0]);')
}
@Override
Set<String> keySet() {
- localStorage.keySet()
+ js.exec('''
Review Comment:
Updated!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]