jonnybot0 commented on code in PR #285:
URL: https://github.com/apache/groovy-geb/pull/285#discussion_r2369831134
##########
module/geb-core/src/main/groovy/geb/webstorage/SessionStorage.groovy:
##########
@@ -18,49 +18,50 @@
*/
package geb.webstorage
-import org.openqa.selenium.html5.SessionStorage as SeleniumSessionStorage
-import org.openqa.selenium.html5.WebStorage as SeleniumWebStorage
+import geb.js.JavascriptInterface
class SessionStorage implements WebStorage {
- private final SeleniumWebStorage webDriver
+ private final JavascriptInterface js
- SessionStorage(SeleniumWebStorage webDriver) {
- this.webDriver = webDriver
+ SessionStorage(JavascriptInterface js) {
+ this.js = js
}
@Override
String getAt(String key) {
- sessionStorage.getItem(key)
+ js.exec(key, 'return window.sessionStorage.getItem(arguments[0]);')
}
@Override
void putAt(String key, String value) {
- sessionStorage.setItem(key, value)
+ js.exec(key, value, 'window.sessionStorage.setItem(arguments[0],
arguments[1]);')
}
@Override
void remove(String key) {
- sessionStorage.removeItem(key)
+ js.exec(key, 'window.sessionStorage.removeItem(arguments[0]);')
}
@Override
Set<String> keySet() {
- sessionStorage.keySet()
+ js.exec('''
+ var out = [];
Review Comment:
How about `Object.keys(window.sessionStorage)` instead?
--
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]